結果
| 問題 |
No.2063 ±2^k operations (easy)
|
| コンテスト | |
| ユーザー |
ks2m
|
| 提出日時 | 2022-09-02 21:57:30 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 198 ms / 2,000 ms |
| コード長 | 621 bytes |
| コンパイル時間 | 3,591 ms |
| コンパイル使用メモリ | 75,008 KB |
| 実行使用メモリ | 54,488 KB |
| 最終ジャッジ日時 | 2024-11-16 03:20:45 |
| 合計ジャッジ時間 | 6,377 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
ソースコード
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
char[] n = sc.next().toCharArray();
sc.close();
int[] c = new int[2];
for (int i = 0; i < n.length; i++) {
c[n[i] - '0']++;
}
if (c[1] == 2) {
System.out.println("Yes");
} else if (c[1] > 2) {
boolean flg = true;
for (int i = 0; i < n.length; i++) {
if (n[i] == '0') {
flg = false;
} else if (!flg) {
System.out.println("No");
return;
}
}
System.out.println("Yes");
} else {
System.out.println("No");
}
}
}
ks2m