結果
| 問題 |
No.547 未知の言語
|
| コンテスト | |
| ユーザー |
Ronlynes
|
| 提出日時 | 2017-07-28 22:27:14 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 714 bytes |
| コンパイル時間 | 797 ms |
| コンパイル使用メモリ | 68,928 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-26 02:11:54 |
| 合計ジャッジ時間 | 1,642 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 33 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:33:17: warning: ‘ans’ may be used uninitialized in this function [-Wmaybe-uninitialized]
33 | cout << ans+1 << endl;
| ^
ソースコード
#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
#include <vector>
#include <map>
#include <set>
using namespace std;
int main(void){
int n;
int ans;
string s1[20], s2[20];
cin >> n;
for(int i=0;i<n;i++){
cin >> s1[i];
}
for(int i=0;i<n;i++){
cin >> s2[i];
}
for(int i=0;i<n;i++){
if(s1[i].length() != s2[i].length()){
ans = i;
}else{
for(int j=0;j<s1[i].length();j++){
if(s1[i][j] != s2[i][j]){
ans = i;
}
}
}
}
cout << ans+1 << endl;
cout << s1[ans] << endl;
cout << s2[ans] << endl;
return 0;
}
Ronlynes