結果

問題 No.389 ロジックパズルの組み合わせ
ユーザー notetonous
提出日時 2016-07-08 23:47:39
言語 C90
(gcc 12.3.0)
結果
TLE  
実行時間 -
コード長 356 bytes
コンパイル時間 175 ms
コンパイル使用メモリ 21,248 KB
実行使用メモリ 14,920 KB
最終ジャッジ日時 2024-10-13 07:32:48
合計ジャッジ時間 6,872 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other TLE * 1 -- * 98
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:22:12: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long long int’ [-Wformat=]
   22 |   printf("%d\n",ans);
      |           ~^    ~~~
      |            |    |
      |            int  long long int
      |           %lld
main.c:8:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |   scanf("%d",&M);
      |   ^~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
int main(){
  int M,i;
  int count=0;
  int x,sum=0;
  long long int mod=1000000007;
  long long int ans=0;
  scanf("%d",&M);
  while(scanf("%d",&x)!=0){
    count++;
    sum+=x;
  }
  M=M-sum;
  ans=M;
  for(i=0;i<count;i++){
    ans*=(M-i);
    ans%=mod;
  }
  for(i=count;i>0;i--){
    ans/=i;
  }
  printf("%d\n",ans);
  return 0;
}
0