結果
| 問題 | 
                            No.112 ややこしい鶴亀算
                             | 
                    
| コンテスト | |
| ユーザー | 
                             yuyu_106
                         | 
                    
| 提出日時 | 2019-06-06 12:34:47 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 392 bytes | 
| コンパイル時間 | 668 ms | 
| コンパイル使用メモリ | 54,596 KB | 
| 実行使用メモリ | 6,948 KB | 
| 最終ジャッジ日時 | 2024-09-25 05:23:54 | 
| 合計ジャッジ時間 | 1,413 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| 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;
}
            
            
            
        
            
yuyu_106