求助,大概是在求X的时候的问题
查看原帖
求助,大概是在求X的时候的问题
302009
lxzcpro楼主2021/2/3 22:09

// 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

2021/2/3 22:09
加载中...