社区讨论
即将成为警钟的帖子
P1080[NOIP 2012 提高组] 国王游戏参与者 1已保存回复 1
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 1 条
- 当前快照
- 1 份
- 快照标识符
- @lytqkzat
- 此快照首次捕获于
- 2024/07/20 14:16 2 年前
- 此快照最后确认于
- 2024/07/20 14:19 2 年前
CPP
#include<bits/stdc++.h>
#define int long long
#define rint register int
using namespace std;
int n;
struct node{
short a[110];
node(){
for(int i=0;i<=110;i++)a[i]=0;
}
inline bool operator<(const node&x)const{
for(int i=100;i;i--){
if(a<x.a)return false;
else if(a>x.a)return true;
}
return false;
}
inline bool operator==(const node&x)const{
for(int i=1;i<=100;i++)if(a[i]!=x.a[i])return false;
return true;
}
inline node operator+(const node&x)const{
node ans;
int q=0;
for(int i=1;i<=100;i++){
ans.a[i]=(a[i]+x.a[i]+q)%10;
q=(a[i]+x.a[i]+q)/10;
}
return ans;
}
inline node operator*(const int&x)const{
node ans;
int q=0;
for(int i=1;i<=100;i++){
ans.a[i]=(a[i]*x+q)%10;
q=(a[i]*x+q)/10;
}
return ans;
}
inline node operator/(const int&x)const{
node ans;
rint q=0;
register bool flag=0;
for(int i=100;i;i--){
if(a[i])flag=1;
if(flag){
q=a[i]+q*10;
if(q>=x){
ans.a[i]=q/x;
q=q%x;
}
}
}
return ans;
}
};
struct game{
int a,b;
inline bool operator<(const game&x){
if(b==x.b)return a<x.a;
return b<x.b;
}
}a[1010];
inline node read(){
node ans;
rint cnt;
register char ch=getchar();
while(isdigit(ch))ans.a[++cnt]=ch-48,ch=getchar();
for(int i=1;i<=cnt/2;i++)swap(ans.a[i],ans.a[cnt-i+1]);
return ans;
}
inline void write(node x){
register bool flag=0;
for(int i=100;i;i--){
if(x.a[i])flag=1;
if(flag)putchar(x.a[i]+48);
}
}
inline node max(node*x,node*y){return x<y?y:x;}
signed main(){
// freopen(".in","r",stdin);
// freopen(".out","w",stdout);
// ios::sync_with_stdio(NULL);
// cin.tie(nullptr);cout.tie(nullptr);
cin>>n;
for(int i=0;i<=n;i++)cin>>a[i].a>>a[i].b;
sort(a+1,a+n+1);
node ans,mul;
mul.a[1]=1;
mul=mul*a[0].a;
for(rint i=1;i<=n;i++){
ans=max(ans,mul/a[i].b);
mul=mul*a[i].a;
}
write(ans);
return 0;
}
wa on all points
too short on line 1.
回复
共 1 条回复,欢迎继续交流。
正在加载回复...