結果

問題 No.2063 ±2^k operations (easy)
ユーザー NAMIDAIRO
提出日時 2022-09-02 21:27:11
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 871 bytes
コンパイル時間 809 ms
コンパイル使用メモリ 96,284 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-16 02:18:49
合計ジャッジ時間 1,648 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <random>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)

template<class T>
using vi = vector<T>;

template<class T>
using vii = vector<vi<T>>;

template<class T>
using viii = vector<vii<T>>;

int main()
{
    string s;
    cin >> s;
    int n = s.size();
    int cnt = 0;
    rep(i, n) if (s[i] == '1') cnt++;
    if (cnt == 2) {
        cout << "Yes" << endl;
        return 0;
    }
    else if (cnt == 1) {
        cout << "No" << endl;
        return 0;
    }

    int cnt2 = 0;
    rep(i, n) {
        if (s[i] == '0') {
            if (cnt == cnt2) cout << "Yes" << endl;
            else cout << "No" << endl;
            return 0;
        }
        cnt2++;
    }
    cout << "Yes" << endl;
    return 0;
}
0