记录编号 |
342013 |
评测结果 |
APAPPPPPAPWTTWWWWTWW |
题目名称 |
[ZLXOI 2015]殉国 |
最终得分 |
26 |
用户昵称 |
zhjian |
是否通过 |
未通过 |
代码语言 |
C++ |
运行时间 |
0.201 s |
提交时间 |
2016-11-08 07:46:54 |
内存使用 |
0.30 MiB |
显示代码纯文本
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<string>
#include<map>
#define N 100005
#define M 25
#define inf 0x3f3f3f3f
#define LL long long
using namespace std;
int n,m;
LL a,b,c;
void work(){
if(a==b){
if(c%a!=0){
cout<<"-1 -1"<<endl<<"0";
}
else{
int x=c/a;
int t=x;
cout<<t<<" "<<t<<endl;
cout<<x+1;
}
return ;
}
double k=(double)a/b;
double lb=(double)c/b;
double la=(double)c/a;
LL x,y;
for(int i=0;;i++){
if(c-b*i<0){
cout<<"-1 -1"<<endl<<"0";
return ;
}
else if((c-b*i)%a==0){
x=(c-b*i)/a;
y=i;
break;
}
}
//cout<<la<<" "<<lb<<" "<<a<<" "<<b<<" "<<x<<" "<<y<<endl;
int num=min((LL)(lb-y)/a,(LL)x/b)+1;
//if((LL)(la-x)%(LL)a==0&&(LL)y%b==0)
// num++;
int minx,maxx;
maxx=x+y;
minx=x-b*(num-1)+y+a*(num-1);
//if(minx>maxx)
// swap(minx,maxx);
cout<<minx<<" "<<maxx<<endl;
cout<<num;
}
int main(){
freopen("BlackHawk.in","r",stdin);
freopen("BlackHawk.out","w",stdout);
cin>>a>>b>>c;
if(a>b)
swap(a,b);
work();
fclose(stdin);
fclose(stdout);
return 0;
}
//1535422272