結果
問題 |
No.547 未知の言語
|
ユーザー |
![]() |
提出日時 | 2018-05-29 22:02:51 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 455 bytes |
コンパイル時間 | 131 ms |
コンパイル使用メモリ | 23,552 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-30 08:03:42 |
合計ジャッジ時間 | 1,185 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 33 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:9:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 9 | scanf("%d\n", &N); | ~~~~~^~~~~~~~~~~~ main.cpp:11:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 11 | scanf("%s ", str1[i]); | ~~~~~^~~~~~~~~~~~~~~~ main.cpp:14:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 14 | scanf("%s ", str2[i]); | ~~~~~^~~~~~~~~~~~~~~~~ main.cpp:21:11: warning: ‘tmp’ may be used uninitialized in this function [-Wmaybe-uninitialized] 21 | printf("%d\n%s\n%s\n", tmp + 1, str1[tmp], str2[tmp]); | ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> #include <string.h> int main(){ int N; char str1[10][21], str2[10][21]; int i, tmp; scanf("%d\n", &N); for(i = 0; i < N; i++){ scanf("%s ", str1[i]); } for(i = 0; i < N; i++){ scanf("%s ", str2[i]); } for(i = 0; i < N; i++){ if(strcmp(str1[i], str2[i]) != 0){ tmp = i; } } printf("%d\n%s\n%s\n", tmp + 1, str1[tmp], str2[tmp]); return 0; }