結果
問題 |
No.129 お年玉(2)
|
ユーザー |
![]() |
提出日時 | 2015-01-16 23:49:30 |
言語 | C90 (gcc 12.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 571 bytes |
コンパイル時間 | 887 ms |
コンパイル使用メモリ | 21,120 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-22 12:49:39 |
合計ジャッジ時間 | 2,077 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 4 WA * 42 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:13:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 13 | scanf("%ld",&N); | ^~~~~~~~~~~~~~~ main.c:14:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 14 | scanf("%d",&M); | ^~~~~~~~~~~~~~
ソースコード
#include <stdio.h> const unsigned long divide = 1000000000; unsigned long combi(int n,int r); int main(int argc, const char * argv[]) { unsigned long N; int M; scanf("%ld",&N); scanf("%d",&M); unsigned long amari = (N - ((N/1000/M*1000) * M)) / 1000; printf("%ld\n",combi(M,(int)amari)); return 0; } unsigned long combi(int n,int r){ int i; unsigned long p=1; for (i=1;i<=r;i++){ p=p*(n-i+1)/i; if(p>= divide){ p%=divide; } } return p; }