結果
| 問題 |
No.2737 Compound Word
|
| コンテスト | |
| ユーザー |
Maeda
|
| 提出日時 | 2025-03-26 17:12:50 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 688 bytes |
| コンパイル時間 | 236 ms |
| コンパイル使用メモリ | 25,984 KB |
| 実行使用メモリ | 7,328 KB |
| 最終ジャッジ日時 | 2025-03-26 17:12:53 |
| 合計ジャッジ時間 | 1,807 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 15 WA * 12 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:6:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
6 | scanf("%d",&n);
| ^~~~~~~~~~~~~~
main.c:9:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
9 | scanf("%s",str[i]);
| ^~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
#include <string.h>
void main(void){
int n = 0 ;
scanf("%d",&n);
char str[n][200];
for(int i = 0 ; i < n ; i++ ){
scanf("%s",str[i]);
}
int count = 0 ;
for(int i = 0 ; i < n ; i++){
for(int j = i+1 ; j < n ; j++){
char strA[1000] = "";
char *strXY = strcat(strA,str[i]);
strXY = strcat(strA,str[j]);
char strB[1000] = "";
char *strYX = strcat(strB,str[j]);
strYX = strcat(strB,str[i]);
if(strcmp(strXY,strYX) == 0){
count++;
}else{
count += 2;
}
}
}
printf("%d",count);
}
Maeda