UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#213160#2348. LifejsxhengCompile Error//C++1.0kb2024-11-09 21:56:222024-11-09 23:23:40

answer

#include<bits/stdc++.h>
#define int long long
using namespace std;
namespace IO{
	template<typename T> inline void read(T &x){
		bool f=1;x=0;char ch=getchar();
		while(ch<'0'||ch>'9'){if(ch=='-')f=0;ch=getchar();}
		while(ch>='0'&&ch<='9')x=(x<<1)+(x<<3)+(ch&15),ch=getchar();
		x=f?x:-x;
	}
	template<typename T> inline void write(T x){
		if(x<0) putchar('-'),x=-x;
	   	if(x>9) write(x/10);
	   	putchar(('0'+x%10));
	}
	template <typename T,typename ...Args> inline void read(T &x,Args &...args){read(x);read(args...);}
	template<typename T> inline void write(T x,char c){write(x),putchar(c);}
}
using namespace IO;
int l,q,x;
unordered_map<int,int> st;
signed main(){
	read(l,q);
	for(int i=-l;i<=l;++i)st[i*i*i]=1;
	while(q--){
		read(x);
		int f=1;
		for(int a=-l;a<=l;++a){
			for(int b=-l;b<=l;++b){
				if(st[x-a*a*a-b*b*b]){
					cout<<a<<" "<<b<<" "<<pow(x-a*a*a-b*b*b,(double)1/3)<<"\n";
					f=0;
					break;
				}
			}
			if(!f)break;
		}
		if(f)cout<<l+1<<" "<<l+1<<" "<<l+1<<"\n";
	}
	return 0;
}

详细

answer.code:16:32: warning: variadic templates only available with -std=c++11 or -std=gnu++11 [enabled by default]
  template <typename T,typename ...Args> inline void read(T &x,Args &...args){read(x);read(args...);}\x0d
                                ^
answer.code:16:72: warning: variadic templates only available with -std=c++11 or -std=gnu++11 [enabled by default]
  template <typename T,typename ...Args> inline void read(T &x,Args &...args){read(x);read(args...);}\x0d
                              ...