結果

問題 No.520 プロジェクトオイラーへの招待
ユーザー horiesiniti
提出日時 2017-05-12 14:22:06
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 361 ms / 4,000 ms
コード長 1,044 bytes
コンパイル時間 695 ms
コンパイル使用メモリ 60,892 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-15 10:42:06
合計ジャッジ時間 1,856 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 7
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:30:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   30 |         scanf("%d",&n);
      |         ~~~~~^~~~~~~~~
main.cpp:34:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   34 |                 scanf("%d %d %d",&a1,&b1,&c1);
      |                 ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #
プレゼンテーションモードにする

#include<iostream>
#include<string.h>
#include<stdio.h>
#include<vector>
const int LIMIT=222;
long long int rf[LIMIT][LIMIT];
long long int MOD=1000000007;
long long int f(int x,int y){
if((x==1)||(y==1)){
return 1;
}else{
return (rf[x-1][y]+rf[x][y-1])%MOD;
}
}
int main(){
memset(rf,0,sizeof(rf));
rf[1][1]=1;
for(int i=2;i<LIMIT*2;i++){
for(int j=1;j<i;j++){
int x=i-j;
int y=j;
if((x>=LIMIT)||(y>=LIMIT))continue;
rf[x][y]=f(x,y);
}
}
int n;
scanf("%d",&n);
std::vector<long long int> anss;
for(int i=0;i<n;i++){
int a1,b1,c1;
scanf("%d %d %d",&a1,&b1,&c1);
long long int ans=0;
ans=(ans+rf[b1][c1+a1+1])%MOD;
ans=(ans+rf[c1][b1+a1+1])%MOD;
ans=(ans+rf[a1][b1+c1+1])%MOD;
for(int a2=1;a2<=a1;a2++){
for(int b2=1;b2<=b1;b2++){
for(int c2=1;c2<=c1;c2++){
long long int perm=(rf[b2][c1-c2+1]*rf[b1-b2+1][a2])%MOD;
perm=(perm*rf[a1-a2+1][c2])%MOD;
ans=(ans+perm)%MOD;
}
}
}
anss.push_back(ans);
}
for(int i=0;i<anss.size();i++){
std::cout<<anss[i]<<"\n";
}
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0