結果
| 問題 |
No.69 文字を自由に並び替え
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-03-06 10:43:02 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 5,000 ms |
| コード長 | 448 bytes |
| コンパイル時間 | 148 ms |
| コンパイル使用メモリ | 20,992 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-12-14 06:30:37 |
| 合計ジャッジ時間 | 778 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 15 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:30:17: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘char (*)[11]’ [-Wformat=]
30 | scanf("%s",&a);
| ~^ ~~
| | |
| | char (*)[11]
| char *
main.c:31:17: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘char (*)[11]’ [-Wformat=]
31 | scanf("%s",&b);
| ~^ ~~
| | |
| | char (*)[11]
| char *
main.c:30:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
30 | scanf("%s",&a);
| ^~~~~~~~~~~~~~
main.c:31:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
31 | scanf("%s",&b);
| ^~~~~~~~~~~~~~
ソースコード
#include<stdio.h>
int sort(char a[]){ /*文字列昇順並び替え関数*/
int i,j,temp;
for(i=0;a[i]!=0;i++){
for(j=i+1;a[j]!=0;j++){
if( a[i] > a[j] ){
temp= a[i];
a[i]=a[j];
a[j]=temp;
}
}
}
}
int main(void){
int i,c=0;
char a[11],b[11];
scanf("%s",&a);
scanf("%s",&b);
sort(a);
sort(b);
for(i=0;a[i]!=0;i++){
if(a[i] != b[i])
c = 1;
}
if(c==1) printf("NO\n");
else printf("YES\n");
return 0;
}