結果
| 問題 | No.616 へんなソート | 
| コンテスト | |
| ユーザー |  tails | 
| 提出日時 | 2017-12-16 01:37:53 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 62 ms / 2,000 ms | 
| コード長 | 366 bytes | 
| コンパイル時間 | 1,458 ms | 
| コンパイル使用メモリ | 157,408 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-12-14 16:48:07 | 
| 合計ジャッジ時間 | 2,668 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 27 | 
コンパイルメッセージ
main.cpp:12:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
   12 | main(){
      | ^~~~
main.cpp: In function ‘int main()’:
main.cpp:13:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   13 |         scanf("%d%d",&n,&k);
      |         ~~~~~^~~~~~~~~~~~~~
            
            ソースコード
#include <bits/stdc++.h>
using namespace std;
#define M 1000000007
typedef long long ll;
int n,k,m,i,j,l,r;
int v[60000];
main(){
	scanf("%d%d",&n,&k);
	v[0]=1;
	m=0;
	for(i=n;--i;){
		m+=i;
		for(j=1;j<=m;++j){
			v[j]=(v[j]+v[j-1])%M;
		}
		for(j=m;j>i;--j){
			v[j]=(v[j]-v[j-i-1]+M)%M;
		}
	}
	int r=0;
	for(;k>=0;--k){
		r=(r+v[k])%M;
	}
	printf("%d",r);
}
            
            
            
        