結果
| 問題 |
No.2714 Amaou
|
| コンテスト | |
| ユーザー |
pengin_2000
|
| 提出日時 | 2024-04-05 21:34:31 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 1,073 bytes |
| コンパイル時間 | 2,049 ms |
| コンパイル使用メモリ | 30,336 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-01 01:47:41 |
| 合計ジャッジ時間 | 1,151 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 26 |
コンパイルメッセージ
main.c:18:6: warning: conflicting types for built-in function 'strcpy'; expected 'char *(char *, const char *)' [-Wbuiltin-declaration-mismatch]
18 | void strcpy(char s[], char t[])
| ^~~~~~
main.c:2:1: note: 'strcpy' is declared in header '<string.h>'
1 | #include<stdio.h>
+++ |+#include <string.h>
2 | int strcmp(char s[], char t[])
ソースコード
#include<stdio.h>
int strcmp(char s[], char t[])
{
for (int i = 0;; i++)
{
if (s[i] == '\0' && t[i] == '\0')
return 0;
if (s[i] == '\0')
return -1;
if (t[i] == '\0')
return 1;
if (s[i] < t[i])
return -1;
if (s[i] > t[i])
return 1;
}
}
void strcpy(char s[], char t[])
{
int i;
for (i = 0; s[i] != '\0'; i++)
t[i] = s[i];
t[i] = s[i];
return;
}
char s[102][4][8];
int main()
{
int n;
scanf("%d", &n);
int i, j, k;
for (i = 0; i < n; i++)
{
for (j = 0; j < 4; j++)
scanf("%s", s[i][j]);
for (j = 0; j < 3; j++)
{
if (strcmp(s[i][j], s[i][j + 1]) > 0)
{
strcpy(s[i][j], s[n][0]);
strcpy(s[i][j + 1], s[i][j]);
strcpy(s[n][0], s[i][j + 1]);
if (j > 0)
j -= 2;
}
}
}
char A[8] = "akai", M[8] = "marui", O[8] = "okii", U[8] = "umai";
int ans = 0;
for (i = 0; i < n; i++)
{
if (strcmp(s[i][0], A) != 0)
continue;
if (strcmp(s[i][1], M) != 0)
continue;
if (strcmp(s[i][2], O) != 0)
continue;
if (strcmp(s[i][3], U) != 0)
continue;
ans++;
}
printf("%d\n", ans);
return 0;
}
pengin_2000