結果
問題 |
No.112 ややこしい鶴亀算
|
ユーザー |
![]() |
提出日時 | 2019-06-06 13:06:48 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 403 bytes |
コンパイル時間 | 532 ms |
コンパイル使用メモリ | 56,104 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-25 06:21:40 |
合計ジャッジ時間 | 1,388 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 2 |
other | WA * 23 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:21:42: warning: ‘abc’ may be used uninitialized in this function [-Wmaybe-uninitialized] 21 | else if(abc<0) cout << a+abc << " "<< -abc; | ^~~
ソースコード
#include <iostream> #include <cstring> using namespace std; int main(){ int a; cin >> a; int x; cin >> x; int y; int abc; for(int i=0; i<a-1; i++){ cin >> y; if(y>x) abc++; else if(y<x) abc--; } if(abc == 0){ if (x/(a-1) == 2) cout << a << " 0"; else cout << "0 " << a; } else if(abc<0) cout << a+abc << " "<< -abc; else cout << abc << " "<< a-abc; cout << endl; return 0; }