想问这个为什么编译不通过,自己电脑上能过
查看原帖
想问这个为什么编译不通过,自己电脑上能过
1283916
cpy12138楼主2024/7/11 20:50
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <ctype.h>

int main(){
    int n;
    scanf("%d", &n);
    int ppp = int(log10(2) * n);
    printf("%d\n", ppp+1);
    int profile[505] = {0};
    profile[0] = 1;
    int flag = 1;
    for (int i = 0; i < n;i++){
        for (int u = flag-1; u >=0;u--){
            profile[u] = profile[u] * 2;
            if(profile[u]>=10){
                profile[u + 1]++;
                profile[u] = profile[u] - 10;
            }
        }
        for (int y = 0; y < flag;y++){
            if(profile[y]>=10){
                profile[y + 1]++;
                profile[y] = profile[y] - 10;
            }
        }
        if((profile[flag]!=0)&&(flag<500)){
            flag++;
        }
    }
    profile[0]--;
    int y = 0;
    while(profile[y]<0){
            profile[y] = profile[y] + 10;
            profile[y + 1]--;
            y++;
    }
        for (int x = 499; x >= 0; x--)
        {
            printf("%d", profile[x]);
        }
}

自己电脑能过,基本没问题,但是提交上去是编译错误

2024/7/11 20:50
加载中...