做不出题就来打一场模拟赛吧!

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 }
View Code

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-01-05
  • 2021-08-12
  • 2021-04-24
  • 2021-12-04
  • 2021-11-19
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-06
  • 2021-08-18
  • 2022-12-23
相关资源
相似解决方案