結果

問題 No.313 π
ユーザー At-sushi
提出日時 2019-07-13 22:53:09
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 9 ms / 5,000 ms
コード長 600 bytes
コンパイル時間 2,293 ms
コンパイル使用メモリ 193,248 KB
最終ジャッジ日時 2025-01-07 06:51:57
ジャッジサーバーID
(参考情報)
judge2 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 32
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:31:12: warning: ‘b’ is used uninitialized [-Wuninitialized]
   31 |     int a, b;
      |            ^
main.cpp:31:9: warning: ‘a’ is used uninitialized [-Wuninitialized]
   31 |     int a, b;
      |         ^

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main() {
    string S;
    
    cin >> S;
    constexpr int nums[] = {
    	20104,
		20063,
		19892,
		20011,
		19874,
		20199,
		19898,
		20163,
		19956,
		19841
	};
    
    const complex<double> one = polar(1.0, -1.0);
    int sums[10] = { 0 };
    
    for (auto i : S) {
        if (isdigit(i)) {
            sums[i - '0']++;
        }
    }
    
    int a, b;
    for (int i = 0; i < 10; i++) {
    	if (nums[i] < sums[i])
    		a = i;
		else if (nums[i] > sums[i])
			b = i;
    }
    
    cout << a << " " << b << endl;
    
    return 0;
}
0