Saturday, 2 June 2012
UVa 11877 The Coco-Cola Store Solution
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cctype>
#include<cmath>
#include<algorithm>
#include<set>
#include<queue>
#include<stack>
#include<list>
#include<iostream>
#include<fstream>
#include<numeric>
#include<string>
#include<vector>
#include<cstring>
#include<map>
#include<iterator>
#define pb push_back
#define file freopen("in.txt","r",stdin);
using namespace std;
int main(){
int n;
int coke=0;
while(scanf("%d",&n)==1){
if(n==0)
break;
coke=0;
while(n>=3){
n=n-3;
coke++;
n+=1;
}
if(n==2)
printf("%d\n",(coke+1));
else
printf("%d\n",coke);
}
return 0;
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment