Skip to content

Instantly share code, notes, and snippets.

@kdxu
Created July 11, 2014 10:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kdxu/cbd502eac68f1810f851 to your computer and use it in GitHub Desktop.
Save kdxu/cbd502eac68f1810f851 to your computer and use it in GitHub Desktop.
#include<iostream>
#include<sstream>
#include<string>
#include<cmath>
#include<cstdio>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<deque>
#include<algorithm>
#include<functional>
#include<numeric>
#define rep(i,b) for(int i = 0 ;i < b ; i++)
using namespace std;
int main(){
//int max = 0;
//int n;
while(1){
int x,y,s;
cin >> x >> y >> s;
if(x==0&&y==0&&s==0){break;}
int result=0;
//5%の税込み価格リスト
int dict[2001];
for(int i=0;i<(2000+1);i++){dict[i]=-1;}
dict[1] = 1;
dict[0] = 0;
for(int i=2;i<(1000);i++){
float a=i*(100+x)/100;
int b=int(a);
//cout << b << endl;
dict[b]=i;
}
//入ってないところ埋める
/*
for(int i=1;i<(s*s+1);i++){
if(dict[i]==-1){dict[i]=dict[i-1];
//if(i<s*5){cout << i << endl;}
}
}*/
for(int i=1;i<(s/2+1);i++){
float a=float(i);//商品1
float b=float(s)-a;//商品2
//int a=i;int b=s-a;
//cout << "a="<<a<< " b=" << b << " ";
//if(dict[i]==-1||dict[s-1]==-1){continue;}
a = dict[i];
//cout << "dicta=" << a <<" ";
a *= (100+y);
a/=100;
//cout << a << " ";
//b
b=dict[s-i];
//cout << "dictb=" << b <<" ";
b= b*(100+y);
b/=100;
//cout << b << " " ;
int c=int(a)+int(b);
// cout << c << endl;
result = max(result,c);
}
cout << result << endl;
}
//cout << max << endl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment