大佬麻烦看一下70分

P1307 [NOIP2011 普及组] 数字反转

ammmmmgoding @ 2023-11-07 09:02:12

#include <stdio.h>

int main() {
    int x;
    scanf("%d", &x); int ooo = x;
    if (x < 0) { x *= (-1); }
    int t = x; int count = 0; int f = x; if (x == 0)printf("0");
    else {
        for (int i = 0; i < 100000000; i++)
            while (x > 0) { x /= 10; count++; }
        for (int i = 0; i < count; i++) {
            if (ooo > 0) {
                if (t < 9) { printf("%d", t); }
                else { f = t % 10; t /= 10; if (f != 0) { printf("%d", f); } }
            }
            else {
                if (i == 0) { printf("%c",'-'); }
                f = t % 10; t /= 10; if (f != 0) {
                    printf("%d", f);
                }
            }
        }
    }
        return 0;
}

by xingjielong @ 2023-11-25 18:31:32

让我康康


by xingjielong @ 2023-11-25 18:33:11

兄弟你搞错了,这是考字符串的题,用整形难弄


by xingjielong @ 2023-11-25 18:38:20

for (int i = 0; i < 100000000; i++)
            while (x > 0) { x /= 10; count++; }

这是个甚么


by xingjielong @ 2023-11-25 18:41:19

帮不了你了


|