結果

問題 No.313 π
ユーザー tottoripapertottoripaper
提出日時 2019-03-16 00:48:38
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 4 ms / 5,000 ms
コード長 684 bytes
コンパイル時間 1,436 ms
コンパイル使用メモリ 163,992 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-14 14:54:58
合計ジャッジ時間 3,230 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
4,376 KB
testcase_01 AC 4 ms
4,376 KB
testcase_02 AC 4 ms
4,380 KB
testcase_03 AC 3 ms
4,380 KB
testcase_04 AC 4 ms
4,376 KB
testcase_05 AC 3 ms
4,380 KB
testcase_06 AC 4 ms
4,376 KB
testcase_07 AC 4 ms
4,376 KB
testcase_08 AC 4 ms
4,376 KB
testcase_09 AC 4 ms
4,376 KB
testcase_10 AC 4 ms
4,376 KB
testcase_11 AC 4 ms
4,380 KB
testcase_12 AC 4 ms
4,380 KB
testcase_13 AC 4 ms
4,376 KB
testcase_14 AC 4 ms
4,380 KB
testcase_15 AC 3 ms
4,376 KB
testcase_16 AC 3 ms
4,380 KB
testcase_17 AC 3 ms
4,380 KB
testcase_18 AC 3 ms
4,376 KB
testcase_19 AC 3 ms
4,376 KB
testcase_20 AC 4 ms
4,376 KB
testcase_21 AC 4 ms
4,380 KB
testcase_22 AC 4 ms
4,376 KB
testcase_23 AC 4 ms
4,380 KB
testcase_24 AC 4 ms
4,376 KB
testcase_25 AC 4 ms
4,376 KB
testcase_26 AC 4 ms
4,376 KB
testcase_27 AC 4 ms
4,376 KB
testcase_28 AC 4 ms
4,376 KB
testcase_29 AC 4 ms
4,376 KB
testcase_30 AC 4 ms
4,376 KB
testcase_31 AC 4 ms
4,380 KB
testcase_32 AC 3 ms
4,376 KB
testcase_33 AC 3 ms
4,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:33:11: 警告: ‘m’ may be used uninitialized [-Wmaybe-uninitialized]
   33 |     printf("%d %d\n", n, m);
      |     ~~~~~~^~~~~~~~~~~~~~~~~
main.cpp:21:12: 備考: ‘m’ はここで定義されています
   21 |     int n, m;
      |            ^
main.cpp:33:11: 警告: ‘n’ may be used uninitialized [-Wmaybe-uninitialized]
   33 |     printf("%d %d\n", n, m);
      |     ~~~~~~^~~~~~~~~~~~~~~~~
main.cpp:21:9: 備考: ‘n’ はここで定義されています
   21 |     int n, m;
      |         ^

ソースコード

diff #

#include <bits/stdc++.h>

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

int cnt[10] = {20104, 20063, 19892, 20011, 19874, 20199, 19898, 20163, 19956, 19841};
std::string S;

int main(){
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);

    std::cin >> S;

    int n, m;
    
    for(int i=0;i<=9;++i){
        int c = std::count(S.begin(), S.end(), '0' + i);

        if(c - 1 == cnt[i]){
            n = i;
        }else if(c + 1 == cnt[i]){
            m = i;
        }
    }

    printf("%d %d\n", n, m);
}
0