結果
問題 |
No.482 あなたの名は
|
ユーザー |
![]() |
提出日時 | 2017-02-10 22:54:33 |
言語 | C90 (gcc 12.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 416 bytes |
コンパイル時間 | 1,056 ms |
コンパイル使用メモリ | 21,376 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-12-28 08:54:21 |
合計ジャッジ時間 | 2,622 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 14 WA * 14 |
コンパイルメッセージ
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:7:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 7 | scanf("%lf",&k); | ^~~~~~~~~~~~~~~ main.c:10:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 10 | scanf("%d",&d[i]); | ^~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> int main(){ int n,i,cnt=0,temp; double k; scanf("%d",&n); scanf("%lf",&k); int d[n+1]; for(i=1;i<=n;i++){ scanf("%d",&d[i]); } for(i=1;i<=n;i++){ if(d[i]!=i){ temp=d[d[i]]; d[d[i]]=d[i]; d[i]=temp; cnt++; } } if(cnt==k||cnt==0)printf("YES\n"); else printf("NO\n"); return 0; }