Problem:http://codeforces.com/contest/746/problem/A
Code:
#include<bits/stdc++.h>
using namespace std;
int main()
{
long long a,b,c,tmp,s,bb,cc;
while(cin>>a>>b>>c)
{
bb=b/2;
cc=c/4;
tmp=a;
if(tmp>cc)
tmp=cc;
if(tmp>bb)
tmp=bb;
//cout<<"tmp="<<tmp<<" "<<a<<" "<<bb<<" "<<cc<<endl;
s=tmp*1+tmp*2+tmp*4;
cout<<s<<endl;
}
return 0;
}
Code:
#include<bits/stdc++.h>
using namespace std;
int main()
{
long long a,b,c,tmp,s,bb,cc;
while(cin>>a>>b>>c)
{
bb=b/2;
cc=c/4;
tmp=a;
if(tmp>cc)
tmp=cc;
if(tmp>bb)
tmp=bb;
//cout<<"tmp="<<tmp<<" "<<a<<" "<<bb<<" "<<cc<<endl;
s=tmp*1+tmp*2+tmp*4;
cout<<s<<endl;
}
return 0;
}
No comments:
Post a Comment