結果
| 問題 |
No.681 Fractal Gravity Glue
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-04-27 23:53:52 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 797 bytes |
| コンパイル時間 | 608 ms |
| コンパイル使用メモリ | 65,484 KB |
| 実行使用メモリ | 13,760 KB |
| 最終ジャッジ日時 | 2024-06-27 22:32:13 |
| 合計ジャッジ時間 | 4,106 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 8 TLE * 1 -- * 11 |
コンパイルメッセージ
main.cpp:42:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
42 | main()
| ^~~~
ソースコード
#include<iostream>
using namespace std;
const long long mod=1e9+7;
long long count(int i,int d)
{
if(i<1)return 0;
else if(i==1)return d;
else return d+count(i-1,d)*(d+1);
}
long long sum(int i,int d)
{
long long ans=0;
for(long long j=1;j<=i;j++)
{
ans=(j*d%mod+ans*(d+1)%mod)%mod;
}
return ans;
}
long long sumcount(int i,int d,int n)
{
cout<<"sumcount "<<i<<endl;
long long s=count(i-1,d),t=sum(i-1,d);
long long now=0;
for(;;)
{
if(n<s)
{
return (now+sumcount(i-1,d,n))%mod;
}
else if(n==s)
{
return (now+t)%mod;
}
else if(n==s+1)
{
return (now+t+i)%mod;
}
now=(now+t+i)%mod;
n-=s+1;
}
}
main()
{
long long n,b,d;cin>>n>>b>>d;
for(int i=1;;i++)
{
if(count(i,d)>n)
{
cout<<(sum(b,d)+mod-sumcount(i,d,n))%mod<<endl;
return 0;
}
}
}