結果

問題 No.500 階乗電卓
ユーザー GJTD74a
提出日時 2017-04-20 00:56:34
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
MLE  
実行時間 -
コード長 432 bytes
コンパイル時間 129 ms
コンパイル使用メモリ 22,784 KB
実行使用メモリ 813,056 KB
最終ジャッジ日時 2024-07-19 09:32:19
合計ジャッジ時間 3,830 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 3
other MLE * 1 -- * 19
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:4:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    4 |     scanf("%lld",&N);
      |     ~~~~~^~~~~~~~~~~
main.cpp:5:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 |     scanf("%lld",&K);
      |     ~~~~~^~~~~~~~~~~
main.cpp:9:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |         scanf("%lld",&hairetu[i]);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
int main(void){
    long long int N,K,i,count;
    scanf("%lld",&N);
    scanf("%lld",&K);
    long long int hairetu[N];
    for(i=1;i<=N;i++)
    {
        scanf("%lld",&hairetu[i]);
    }
    count=0;
    while(i!=hairetu[i])
    {
        hairetu[hairetu[i]]=hairetu[i];
        count++;
    }
    if((K-count)%2==0 && K-count>=0)
    {
        printf("YES");
    }
    else
    {
        printf("NO");
    }
}
0