結果
| 問題 |
No.112 ややこしい鶴亀算
|
| コンテスト | |
| ユーザー |
yuyu_106
|
| 提出日時 | 2019-06-06 12:10:19 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 394 bytes |
| コンパイル時間 | 952 ms |
| コンパイル使用メモリ | 54,956 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-25 04:29:29 |
| 合計ジャッジ時間 | 1,474 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 2 |
| other | AC * 3 WA * 20 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:23:32: warning: ‘abc’ may be used uninitialized in this function [-Wmaybe-uninitialized]
23 | else 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 << -abc << " "<< a+abc;
else cout << a-abc << " "<< abc;
cout << endl;
}
yuyu_106