Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

本人急需,快

Posted by caizixian at 2010-03-30 16:22:47 on Problem 3539
In Reply To:大牛们,小弟求AC代码,发到邮箱fzczx123@163.com 小弟不胜感激!!!! 小弟自己做了一个,附在下面,却总是WA Posted by:caizixian at 2010-03-20 12:18:33
> #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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator