結果

問題 No.2737 Compound Word
ユーザー 2475057t
提出日時 2024-07-09 14:07:12
言語 C
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 637 bytes
コンパイル時間 949 ms
コンパイル使用メモリ 28,544 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-09 14:07:14
合計ジャッジ時間 2,572 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 15 WA * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <string.h>
int main(void){
    int N = 0, cnt = 0;
    scanf("%d", &N);
    char s[N][100];
    for(int i=0; i<N; i++){
        scanf("%s", s[i]);
    }
    for(int i=0; i<N; i++){
        for(int j=i+1; j<N; j++){
            if(i != j){
                char T[2][300];
                sprintf(T[0], "%s%s", s[i], s[j]);
                sprintf(T[1], "%s%s", s[j], s[i]);
                if(strcmp(T[0], T[1]) == 0){
                    cnt++;
                }
                else{
                    cnt = cnt + 2;
                }
            }
        }
    }
    printf("%d\n", cnt);

    return 0;
}
0