Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
大牛们,小弟求AC代码,发到邮箱fzczx123@163.com 小弟不胜感激!!!! 小弟自己做了一个,附在下面,却总是WA#include<iostream> #include<cstdio> #include<cstring> #include<cstdlib> #include<queue> #include<vector> using namespace std; #define maxn 100100 int vst[maxn], que[maxn << 1], head, tail; int a, b, c, u; long long ret, h; int main() { cin>>h>>a>>b>>c; while (head < tail) { u = que[head++]; if (!u) {u = a; vst[u] = vst[0];} if (!vst[(u+b)%a] || vst[u]+(u+b>a)<vst[(u+b)%a]) { que[tail++] = (u+b)%a; } if (!vst[(u+c)%a] || vst[u]+(u+c>a)<vst[(u+c)%a]) { que[tail++] = (u+c)%a; } } ret = 0; for (int i=1;i<=a;++i) if (vst[i] && h >= i) { ret += (2 + (long long)(h-i)/(long long)a - (long long)vst[i]) >? 0; } cout<<ret<<endl; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator