A2567196969 @ 2024-12-12 12:25:15
为什么输入和输出和样例一模一样但是显示WA
by KarmaticEnding @ 2024-12-12 12:25:56
@A2567196969
你可以看:数据范围
by banglee @ 2024-12-12 12:26:10
@A2567196969 给代码
by KarmaticEnding @ 2024-12-12 12:27:03
@A2567196969
要是没懂,测一下这组样例
输入:
100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
10
输出:
10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
by LionBlaze @ 2024-12-12 12:43:47
@A2567196969 Talk is cheap. Show me your code.
by wuyouawa @ 2024-12-12 12:47:13
@LionBlaze 他的提交记录里找到了:这里
by A2567196969 @ 2024-12-13 23:42:40
@banglee
#include<string.h>
#include<stdio.h>
int main()
{
char str1[5001] = { 0 };
int b;
gets(str1);
scanf("%d", &b);
int len1 = strlen(str1);
int arr1[20001] = { 0 };
int num1 = 0;
for (int i = 0; i < len1; i++)
{
num1 = num1 * 10 + (str1[i] - '0');
arr1[i] = num1 / b;
num1 = num1 % b;
}
int num2 = 0;
for (int i = 0; i < len1; i++)
{if (arr1[i] != 0)num2 = 1;
if (num2 == 1)printf("%d", arr1[i]);
}
if (num2 == 0)printf("0");
}@KarmaticEnding@banglee