QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#75159#5236. Wersja dla profesjonalistów [A]XZTmaxsmall67Compile Error//C++23589b2023-02-04 15:59:172023-02-04 16:00:51

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-02-04 16:00:51]
  • 评测
  • [2023-02-04 15:59:17]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
using namespace std;
int n;
string add(string a,int v)
{
	if(!v)return;
	if(v<10)return to_string(v)+"["+a+"]";
	return "9["+add(a,v/9)+"]"+string(a,v%9);
}
string work(int n)
{
	if(n==1)return "AE";
	if(n==2)return "AEACAEE";
	if(n%2==0)return add("A",n)+add("EC",n-1)+"E"+work(n-1);
	int a=(n-1)/2;
	string s=add("AC",a)+"A";
	string s1=add("CE",a)+"C"+add("A",a+1);
	string s2=add("E",n);
	return "2["+work(a)+"]"+s+add(s1,a)+s2;
}
signed main()
{
	cin>>n;
	cout<<work(n);
	cout<<add("C",n);
	return 0;
}
/*
*/ 

详细

answer.code: In function ‘std::string add(std::string, long long int)’:
answer.code:7:15: error: return-statement with no value, in function returning ‘std::string’ {aka ‘std::__cxx11::basic_string<char>’} [-fpermissive]
    7 |         if(!v)return;
      |               ^~~~~~