結果
| 問題 | 
                            No.520 プロジェクトオイラーへの招待
                             | 
                    
| コンテスト | |
| ユーザー | 
                             horiesiniti
                         | 
                    
| 提出日時 | 2016-07-05 09:53:29 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 692 bytes | 
| コンパイル時間 | 633 ms | 
| コンパイル使用メモリ | 55,512 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-10-12 20:15:45 | 
| 合計ジャッジ時間 | 1,117 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | WA * 7 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:26:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   26 |         scanf("%d",&n);
      |         ~~~~~^~~~~~~~~
            
            ソースコード
#include<iostream>
#include<string.h>
#include<stdio.h>
const int LIMIT=204;
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;i++){
		for(int j=1;j<i;j++){
			int x=i-j;
			int y=j;
			rf[x][y]=f(x,y);
		}
	}
	int n;
	scanf("%d",&n);
	long long int ans=(rf[n-1][(n-1)*2+1]*3)%MOD;
	for(int i=1;i<n;i++){
		for(int j=1;j<n;j++){
			for(int k=1;k<n;k++){
				long long int perm=(f(n-i,j)*f(n-j,k))%MOD;
				perm=(perm*f(n-k,i))%MOD;
				ans=(ans+perm)%MOD;
			}
		}
	}
	std::cout<<ans<<"\n";	
}
            
            
            
        
            
horiesiniti