Skip to content

Instantly share code, notes, and snippets.

@mizushou
Last active October 24, 2017 23:59
Show Gist options
  • Save mizushou/2af0bd4585486ec23916e8218cc1c79f to your computer and use it in GitHub Desktop.
Save mizushou/2af0bd4585486ec23916e8218cc1c79f to your computer and use it in GitHub Desktop.
# 171022 Code festival 予選 C * 問題 * http://code-festival-2017-qualc.contest.atcoder.jp/ * 解説 * https://img.atcoder.jp/code-festival-2017-qualc/editorial.pdf * その他 * Javaのべき乗って演算子ないんだ、しかもMath.powはdoubleしかない。めんどう
import java.util.Scanner;
public class SimilarArrays {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] A = new int[n];
for(int i=0; i<n; i++){
A[i] = sc.nextInt();
};
sc.close();
int o=1;
for(int i=0; i<n; i++){
if(A[i]%2 == 0) o *=2;
};
System.out.println((int)Math.pow(3,n) - o);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment