# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
823325 | Shithila | Wiring (IOI17_wiring) | C++14 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<iostream>
#include<functional>
using namespace std;
int main()
{
int n;
cin>>n;
for(int i=0;i<n;i++)
{
int x;
int y;
int r;
int s;
int w;
cin>>r>>s>>x>>y>>w;
function<int(int,int)> dfs = [&](int pos,int val){
if(val==x)
{
int tans=1;
for(int i=pos;i<y;i++)
{
tans=tans*s;
}
return tans;
}
if(pos==y)
{return 0;}
return ((s-r+1)*dfs(pos+1,val+1))+(dfs(pos+1,val)*(r-1));
};
int ans=dfs(0,0);
int ss=1;
for(int i=0;i<y;i++)
{
ss=ss*s;
//cout<<ss<<endl;
}
//cout<<ss;
if((ans*w)>(ss))
{
cout<<"yes"<<endl;
}
else cout<<"no"<<endl;
}
}