做不出题就来打一场模拟赛吧!
http://codeforces.com/contest/740
A. Alyona and copybooks
水,直接暴力for吧,特判容易被HACK
1 #include<iostream> 2 #include<cstdio> 3 #include<algorithm> 4 #include<vector> 5 #include<cstdlib> 6 #include<cmath> 7 #include<cstring> 8 using namespace std; 9 #define maxn 10010 10 #define llg long long 11 #define yyj(a) freopen(a".in","r",stdin),freopen(a".out","w",stdout); 12 llg n,m,a,b,c,ans; 13 int main() 14 { 15 // yyj("A"); 16 cin>>n>>a>>b>>c; 17 ans=(llg)1e18; 18 for (llg x=0;x<=10;x++) 19 for (llg y=0;y<=10;y++) 20 for (llg z=0;z<=10;z++) 21 { 22 if ((n+x+y*2+z*3)%4==0) ans=min(ans,a*x+b*y+c*z); 23 } 24 cout<<ans; 25 return 0; 26 }