結果

問題 No.547 未知の言語
ユーザー bal4u
提出日時 2019-04-18 18:06:06
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 616 bytes
コンパイル時間 414 ms
コンパイル使用メモリ 29,952 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-22 10:37:51
合計ジャッジ時間 1,591 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 33
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:25:17: warning: data definition has no type or storage class
   25 | char s[12][25]; len[12];
      |                 ^~~
main.c:25:17: warning: type defaults to 'int' in declaration of 'len' [-Wimplicit-int]

ソースコード

diff #

// yukicoder: No.547 未知の言語
// 2019.4.18 bal4u

#include <stdio.h>
#include <ctype.h>
#include <string.h>

#define gc() getchar()
int in()
{
	int n = 0, c = gc();
	do n = 10 * n + (c & 0xf), c = gc(); while (c >= '0');
	return n;
}

int ins(char *s)
{
	char *p = s;
	do *s = gc();
	while (*s++ > ' ');
	*--s = 0;
	return s - p;
}

char s[12][25]; len[12];
char t[25];

int main()
{
	int i, w, N;
	
	N = in(); for (i = 0; i < N; i++) len[i] = ins(s[i]);
	for (i = 0; i < N; i++) {
		w = ins(t);
		if (w != len[i] || memcmp(t, s[i], w)) {
			printf("%d\n%s\n%s\n", i+1, s[i], t);
			break;
		}
	}
	return 0;
}
0