結果
| 問題 |
No.129 お年玉(2)
|
| コンテスト | |
| ユーザー |
TLwiegehtt
|
| 提出日時 | 2015-07-14 22:05:02 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 600 bytes |
| コンパイル時間 | 173 ms |
| コンパイル使用メモリ | 22,144 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-08 07:19:34 |
| 合計ジャッジ時間 | 3,126 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 4 WA * 42 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:39:20: warning: format ‘%d’ expects argument of type ‘int *’, but argument 2 has type ‘long long int *’ [-Wformat=]
39 | scanf("%I64d", &n);
| ~~~~^ ~~
| | |
| | long long int *
| int *
| %I64lld
main.c:40:20: warning: format ‘%d’ expects argument of type ‘int *’, but argument 2 has type ‘long long int *’ [-Wformat=]
40 | scanf("%I64d", &m);
| ~~~~^ ~~
| | |
| | long long int *
| int *
| %I64lld
main.c:39:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
39 | scanf("%I64d", &n);
| ^~~~~~~~~~~~~~~~~~
main.c:40:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
40 | scanf("%I64d", &m);
| ^~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
int C(int n, int r){
int i, j, tr;
int tmp[10010]={0};
long long int sum = 1;
if( n < r ){return 0;}
for(i=n;i>1;i--){
if( r == i ){break;}
if( (n-r) == i ){break;}
tmp[i] = i;
}
tr = n-i;
for(i=2;i<=tr;i++){
for(j=n;j>1;j--){
if(tmp[j]%i == 0){
tmp[j] /= i;
}
}
}
for(i=1;i<=n;i++){
if(tmp[i] != 0){
sum = (sum*tmp[i])% 1000000000;
}
}
return (int)(sum);
}
int main(void){
long long int n,m,r;
n=24500;
m=9;
scanf("%I64d", &n);
scanf("%I64d", &m);
r = (n / 1000) % m;
printf("%d\n", C((int)m,(int)r));
return 0;
}
TLwiegehtt