結果

問題 No.224 文字列変更(easy)
ユーザー shi-mo
提出日時 2016-04-07 23:40:29
言語 C90
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 317 bytes
コンパイル時間 169 ms
コンパイル使用メモリ 20,992 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-18 02:13:22
合計ジャッジ時間 873 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:8:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |     scanf("%d\n", &n);
      |     ^~~~~~~~~~~~~~~~~
main.c:9:5: warning: ignoring return value of ‘fgets’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |     fgets(s, sizeof(s), stdin);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~
main.c:10:5: warning: ignoring return value of ‘fgets’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |     fgets(t, sizeof(t), stdin);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int
main(int argc, char *argv[])
{
    int n, i, ans;
    char s[1000+2], t[1000+2];
    scanf("%d\n", &n);
    fgets(s, sizeof(s), stdin);
    fgets(t, sizeof(t), stdin);

    ans = 0;
    for (i = 0; i < n; i++) {
        if (s[i] != t[i]) ans++;
    }
    printf("%d\n", ans);

    return 0;
}
0