結果
| 問題 |
No.313 π
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-12-07 16:04:05 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 6 ms / 5,000 ms |
| コード長 | 440 bytes |
| コンパイル時間 | 511 ms |
| コンパイル使用メモリ | 58,612 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-14 18:19:50 |
| 合計ジャッジ時間 | 1,877 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 32 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:20:27: warning: ‘f’ may be used uninitialized in this function [-Wmaybe-uninitialized]
20 | std::cout << f << " " << t << std::endl;
| ^~~
main.cpp:20:34: warning: ‘t’ may be used uninitialized in this function [-Wmaybe-uninitialized]
20 | std::cout << f << " " << t << std::endl;
| ^
ソースコード
#include <iostream>
#include <string>
#include <fstream>
int main()
{
int b[10]={20104,20063,19892,20011,19874,20199,19898,20163,19956,19841,};
std::string s;std::cin >> s;int n[10] = {0};
for(const char c : s)
if(c != '.' && (c >= '0' && c <= '9'))
n[c - '0']++;
int t, f;
for(int i = 0; i < 10; i++){
if(n[i] == b[i] + 1)
f = i;
if(n[i] == b[i] - 1)
t = i;
}
std::cout << f << " " << t << std::endl;
return 0;
}