結果
問題 | No.2063 ±2^k operations (easy) |
ユーザー | tnakao0123 |
提出日時 | 2022-09-04 02:33:25 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 658 bytes |
コンパイル時間 | 690 ms |
コンパイル使用メモリ | 42,752 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-17 18:53:15 |
合計ジャッジ時間 | 1,081 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
/* -*- coding: utf-8 -*- * * 2063.cc: No.2063 ±2^k operations (easy) - yukicoder */ #include<cstdio> #include<cstring> #include<algorithm> using namespace std; /* constant */ const int MAX_N = 100000; /* typedef */ /* global variables */ char s[MAX_N + 4]; /* subroutines */ /* main */ int main() { scanf("%s", s); int n = strlen(s); int c = 0; for (int i = 0; i < n; i++) c += (s[i] - '0'); if (c <= 2) { if (c == 2) puts("Yes"); else puts("No"); return 0; } int k = 0; while (k < n && s[k] == '1') k++; while (k < n && s[k] == '0') k++; if (k == n) { puts("Yes"); return 0; } puts("No"); return 0; }