結果
| 問題 |
No.547 未知の言語
|
| コンテスト | |
| ユーザー |
AQUA16573837
|
| 提出日時 | 2018-03-12 00:21:28 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| コード長 | 430 bytes |
| コンパイル時間 | 230 ms |
| コンパイル使用メモリ | 34,380 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-26 03:03:55 |
| 合計ジャッジ時間 | 1,207 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 33 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
8 | scanf("%d", &n);
| ~~~~~^~~~~~~~~~
main.cpp:11:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
11 | scanf("%s", s[i]);
| ~~~~~^~~~~~~~~~~~
main.cpp:13:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
13 | scanf("%s", t[i]);
| ~~~~~^~~~~~~~~~~~
main.cpp:20:15: warning: ‘res’ may be used uninitialized in this function [-Wmaybe-uninitialized]
20 | printf("%d\n%s\n%s\n", res + 1, s[res], t[res]);
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
#include <algorithm>
using namespace std;
using ll = long long;
int main() {
int n, p, res;
scanf("%d", &n);
char s[10][21], t[10][21];
for (int i = 0; i < n; i++)
scanf("%s", s[i]);
for (int i = 0; i < n; i++)
scanf("%s", t[i]);
for (int i = 0; i < n; i++)
for (p = 0; s[i][p] != 0 && t[i][p] != 0; p++)
if (s[i][p] != t[i][p])
res = i;
printf("%d\n%s\n%s\n", res + 1, s[res], t[res]);
}
AQUA16573837