結果
| 問題 |
No.2063 ±2^k operations (easy)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-09-02 21:56:18 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 2,000 ms |
| コード長 | 487 bytes |
| コンパイル時間 | 1,882 ms |
| コンパイル使用メモリ | 192,988 KB |
| 最終ジャッジ日時 | 2025-02-07 01:12:10 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main () {
int sum = 0;
int n = 0;
string s;
cin >> s;
char p = '0';
for (auto c : s) {
sum += (c == '1');
if (p == '0' && c == '1') {
n ++;
}
p = c;
}
if (sum == 2) {
cout << "Yes" << endl;
} else if (sum == 1) {
cout << "No" << endl;
} else if (n == 1) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
}