社区讨论
求助,大概是在求X的时候的问题
P1055[NOIP 2008 普及组] ISBN 号码参与者 3已保存回复 3
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 3 条
- 当前快照
- 1 份
- 快照标识符
- @locnpn9i
- 此快照首次捕获于
- 2023/10/30 16:47 2 年前
- 此快照最后确认于
- 2023/11/05 03:48 2 年前
CPP
// Problem: P1055 [NOIP2008 普及组] ISBN 号码
// Contest: Luogu
// URL: https://www.luogu.com.cn/problem/P1055
// Memory Limit: 125 MB
// Time Limit: 1000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)
#include<bits/stdc++.h>
using namespace std;
int a,b,c,d,e,f,g,h,i,n,x;
int main()
{
scanf("%c-%c%c%c-%c%c%c%c%c-%c",&a,&b,&c,&d,&e,&f,&g,&h,&i,&n);
printf("%c %c %c %c %c %c %c %c %c %c\n",a,b,c,d,e,f,g,h,i,n);
x=a*1+b*2+c*3+d*4+e*5+f*6+g*7+h*8+i*9;
cout<<x<<endl;
x=x%11;
cout<<x<<endl;
if(x==n) cout<<"Right";
else printf("%c-%c%c%c-%c%c%c%c%c-%c",a,b,c,d,e,f,g,h,i,x);
return 0;
}
RT,大概是在求x时候的问题,但是x求出来并不是158,而是2318
回复
共 3 条回复,欢迎继续交流。
正在加载回复...