社区讨论

Need Helping

P1581A+B Problem(升级版)参与者 2已保存回复 3

讨论操作

快速查看讨论及其快照的属性,并进行相关操作。

当前回复
3 条
当前快照
1 份
快照标识符
@mlrbgq2s
此快照首次捕获于
2026/02/18 08:51
昨天
此快照最后确认于
2026/02/18 22:56
13 小时前
查看原帖
改了 ii 年还是只能拿 8080 分,Who can help me ?!Who\ can\ help\ me\ ?!

Code with 80% ACCode\ with\ 80\%\ AC

CPP
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5+5;
int add[7]={0,2,3,5,7,11,13};
string str;
bool miss=false;
int a[N],b[N],as,bs,c[N];
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	getline(cin,str);
	for(int i=str.size()-1;i>=0;i--){
		if(!miss && str[i]>='0' && str[i]<='9'){
			bs++;
			b[bs]=str[i]-'0';
		}
		if(str[i]=='+'){
			miss=true;
		}
		if(miss && str[i]>='0' && str[i]<='9'){
			as++;
			a[as]=str[i]-'0';
		}
	}
	for(int i=1;i<=6;i++){
		c[i]=a[i]+b[i];
	}
	for(int i=1;i<=6;i++){		
		if(c[i]>=add[i]){
			c[i+1]+=c[i]/add[i];
			c[i]%=add[i];
		}
	}
	int cs=7;
	while(c[cs]==0){
		cs--;
	}
	for(int i=1;i<=cs;i++){
		cout<<c[cs-i+1];
		if(i!=cs){
			cout<<",";
		}
	}
	return 0;
}

回复

3 条回复,欢迎继续交流。

正在加载回复...