結果

問題 No.547 未知の言語
ユーザー complement_realcomplement_real
提出日時 2017-07-28 22:27:17
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 378 bytes
コンパイル時間 3,285 ms
コンパイル使用メモリ 58,204 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-26 02:12:15
合計ジャッジ時間 1,606 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 33
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:20:21: warning: ‘ans’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   20 |         cout << ans+1 << endl;
      |                     ^

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(){
	int N,ans;
	cin >> N;
	string S[10], T[10];
	for (int i = 0; i < N; i++){
		cin >> S[i];
	}
	for (int i = 0; i < N; i++){
		cin >> T[i];
	}
	for (int i = 0; i < N; i++){
		if (S[i] != T[i]){
			ans = i;
		}
	}
	cout << ans+1 << endl;
	cout << S[ans] << endl;
	cout << T[ans] << endl;
}
0