fnfyu @ 2023-09-27 15:28:38
#include<stdio.h>
#include<string.h>
int main()
{
char arr[11] = { 0 }, tmp;
scanf("%s", arr);
int len = strlen(arr), i,len1,j;
len1 = len;
if (arr[0] == '-')
{
for (i = 1; i < len1 && (len1 - 1 != i); i++)
{
tmp = arr[i];
arr[i] = arr[len1 - 1];
arr[len1 - 1] = tmp;
len1--;
}
j = 1;
while (arr[1] == 48)
{
for (i = 2; i < len; i++)
{
arr[i - 1] = arr[i];
}
arr[i-1] = 0;
j++;
}
}
else
{
for (i = 0; i < len1 && (len1 - 1 != i); i++)
{
tmp = arr[i];
arr[i] = arr[len1 - 1];
arr[len1 - 1] = tmp;
len1--;
}
j = 0;
while (arr[0] == 48)
{
for (i = 1; i < len; i++)
{
arr[i-1] = arr[i];
}
arr[i-1] = 0;
j++;
}
}
printf("%s", arr);
return 0;
}
问一下各位大佬为什么 那个#1过不去 本蒟蒻下不了数据 想知道数据是多少
by SSqwq_ @ 2023-09-27 16:16:24
@fnfyu
请对输入为
鉴定为没判 corner case 导致的。
by fnfyu @ 2023-09-27 16:32:37
@Summer_Sheep 收到! 感谢!!