結果

問題 No.239 にゃんぱすー
ユーザー tell0risa
提出日時 2015-11-02 15:40:51
言語 C90
(gcc 12.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 904 bytes
コンパイル時間 342 ms
コンパイル使用メモリ 21,376 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-13 07:02:03
合計ジャッジ時間 1,261 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 33
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:13:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   13 |     scanf("%d", &all);
      |     ^~~~~~~~~~~~~~~~~
main.c:19:13: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   19 |             scanf("%s", murabito[i][j]);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

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

int main(void)
{
    
    int all;
    int i, j;
    static char murabito[101][101][31];
    int kaisu;
    int result = -1;
    
    scanf("%d", &all);
    
    for (i = 1; i <= all; i++)
    {
        for (j = 1; j <= all; j++)
        {
            scanf("%s", murabito[i][j]);
        }
    }
    
    for (j = 1; j <= all; j++)
    {
        kaisu = 0;
        for (i = 1; i <= all; i++)
        {
            if (strcmp(murabito[i][j], "nyanpass") == 0)
            {
                kaisu++; /*にゃんぱすと挨拶をした回数*/
            }
        }
        if (kaisu == all - 1)
        {
            if (result == -1)
            {
                result = j;
            }
            else
            {
                result = -1;
                break;
            }
        }
        
    }
    printf("%d\n", result);
    
    return 0;
}
0