QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#310727#5236. Wersja dla profesjonalistów [A]xinhaowenCompile Error//C++141.5kb2024-01-21 17:13:552024-01-21 17:13:55

Judging History

你现在查看的是最新测评结果

  • [2024-01-21 17:13:55]
  • 评测
  • [2024-01-21 17:13:55]
  • 提交

answer

#include<string>
#include<cstdio>
#include<iostream>
#include<algorithm>
// #define inf 0x3f3f3f3f
// #define int long long
// #define getchar getchar_unlocked
// #define putchar putchar_unlocked
template<typename T>void read(T &x){
	x=0;bool f=0;char ch=getchar();
	for(;ch<'0'||ch>'9';ch=getchar())if(ch=='-')f=1;
	for(;ch>='0'&&ch<='9';ch=getchar())x=(x<<1)+(x<<3)+(ch^48);
	if(f)x=-x;
}
void write(char x){putchar(x);}
template<typename T>void write(T x){
	if(x<0)putchar('-'),x=-x;
	char stk[24];int cnt=0;
	do stk[++cnt]=x%10+48,x/=10;while(x);
	for(;cnt;)putchar(stk[cnt--]);
}
template<typename T,typename ...Args>void read(T &x,Args &...args){read(x);read(args...);}
template<typename T,typename ...Args>void write(T x,Args ...args){write(x);write(args...);}
template<typename T>T min(T x,T y){return x<y?x:y;}
template<typename T>T max(T x,T y){return x>y?x:y;}
int n;
std::string dfs(int x,std::string S){
    if(x<=9){
        if(x==1)return S;
        else if(x)return char(x+'0')+std::string("[")+S+"]";
        return "";
    }
    return dfs(x/9,"9["+S+"]")+dfs(x%9,S);
}
void solve(int x){
    if(x==1){std::cout<<"AE";return;}
    if(x&1){
        std::cout<<"2[";solve(x/2);write(']');
        std::cout<<dfs(x/2,"AC")<<dfs(x/2,"AC"+dfs(x/2,"EC")+dfs(x/2,"A"))<<"A"<<dfs(nx,"E");
    }
    else std::cout<<dfs(x,"A")<<dfs(x-1,"EC")<<dfs(1,"E"),solve(x-1);
}
signed main(){
    read(n);solve(n);std::cout<<dfs(n,"C");
    return 0;
}

详细

answer.code: In function ‘void solve(int)’:
answer.code:39:86: error: ‘nx’ was not declared in this scope; did you mean ‘x’?
   39 |         std::cout<<dfs(x/2,"AC")<<dfs(x/2,"AC"+dfs(x/2,"EC")+dfs(x/2,"A"))<<"A"<<dfs(nx,"E");
      |                                                                                      ^~
      |                                                                                      x