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