結果
問題 | No.2063 ±2^k operations (easy) |
ユーザー |
![]() |
提出日時 | 2022-09-02 21:21:58 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 4 ms / 2,000 ms |
コード長 | 507 bytes |
コンパイル時間 | 569 ms |
コンパイル使用メモリ | 65,504 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-16 02:10:05 |
合計ジャッジ時間 | 1,270 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
#include <string> #include <iostream> using namespace std; int main() { string s; cin >> s; int onecnt = 0; for (int i = 0; i < int(s.size()); i++) { if (s[i] == '1') { onecnt += 1; } } if (onecnt == 1) { cout << "No" << endl; } else { int diffcnt = 0; for (int i = 0; i < int(s.size()) - 1; i++) { if (s[i] != s[i + 1]) { diffcnt += 1; } } if (s[s.size() - 1] == '1') { diffcnt += 1; } cout << (onecnt == 2 || diffcnt == 1 ? "Yes" : "No") << endl; } return 0; }