Submission #23859593
Source Code Expand
Copy
import java.util.*;public class Main {public static void main(String[] args) {// 入力Scanner sc = new Scanner(System.in);int n = Integer.parseInt(sc.next());int[] a = new int[n];for (int i = 0; i < n; i++) {a[i] = Integer.parseInt(sc.next());}int entire = 1;int temp = 1;for (int i = 0; i < n; i++) {entire *= 3;temp *= (a[i] % 2 == 0) ? 2 : 1;}
import java.util.*; public class Main { public static void main(String[] args) { // 入力 Scanner sc = new Scanner(System.in); int n = Integer.parseInt(sc.next()); int[] a = new int[n]; for (int i = 0; i < n; i++) { a[i] = Integer.parseInt(sc.next()); } int entire = 1; int temp = 1; for (int i = 0; i < n; i++) { entire *= 3; temp *= (a[i] % 2 == 0) ? 2 : 1; } System.out.println(entire - temp); } }
Submission Info
Submission Time | |
---|---|
Task | B - Similar Arrays |
User | tobi00604 |
Language | Java (OpenJDK 11.0.6) |
Score | 200 |
Code Size | 464 Byte |
Status | AC |
Exec Time | 109 ms |
Memory | 35672 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 200 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | subtask0_0.txt, subtask0_1.txt, subtask0_2.txt, subtask0_3.txt |
All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, subtask0_0.txt, subtask0_1.txt, subtask0_2.txt, subtask0_3.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | AC | 108 ms | 35436 KB |
02.txt | AC | 101 ms | 35604 KB |
03.txt | AC | 106 ms | 35600 KB |
04.txt | AC | 102 ms | 35480 KB |
05.txt | AC | 101 ms | 35620 KB |
06.txt | AC | 102 ms | 35576 KB |
07.txt | AC | 102 ms | 35564 KB |
subtask0_0.txt | AC | 98 ms | 35596 KB |
subtask0_1.txt | AC | 109 ms | 35628 KB |
subtask0_2.txt | AC | 107 ms | 35640 KB |
subtask0_3.txt | AC | 109 ms | 35672 KB |