QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#474113#5090. 妙妙题yz_lyCompile Error//C++141.3kb2024-07-12 16:10:402024-07-12 16:10:42

Judging History

This is the latest submission verdict.

  • [2024-07-12 16:10:42]
  • Judged
  • [2024-07-12 16:10:40]
  • Submitted

answer

#include<bits/stdc++.h>
using namespace std;
inline int read(){
	int f=1,x=0;
	char ch=getchar();
	while(ch<'0'||ch>'9'){
		if(ch=='-')
			f=-f;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9'){
		x=x*10+ch-'0';
		ch=getchar();
	}
	return f*x;
}
inline void work(int k){
	if(k<0){
		putchar('-');
		k=-k;
	}
	if(k>9)
		work(k/10);
	putchar(k%10+'0');
}
/*
如果一个人知道0/1的奇偶性,就可以直接猜出自己的颜色
首先先不管同样的情况猜测相同的情况,很明显砍一半,一半认为0是奇数,一半认为0是偶数,这样肯定能够对一半
但是在这里很明显行不通,所以我们换一种方式,我们用向量来刻画每个人的策略
将n个人均匀放置,将所有黑色的人的向量加起来看成那条分界线就行了
特别地,如果是0向量就猜0,如果与自己共线猜1
容易发现自己是否为1不影响自己在分界线的哪一边
*/
const double pi=acos(-1),esp=1e-7;
double a[105],b[105];
void init(int n,bool t,int p){
	for(int i=0;i<n;i++){
		a[i]=cos(2*pi*i/n);
		b[i]=sin(2*pi*i/n);
	}
}
bool guess(unsigned long long A,int x){
	double x=0,y=0;
	int num=0;
	for(int i=1;i<n;i++){
		if((A>>i)&1){
			x+=a[i];
			y+=b[i];
			num++;
		}
	}
	if(y<esp&&y>-esp){
		if(x<esp&&x>-esp)
			return 0;
		return 1;
	}
	return (y<-esp)^(num&1);
}

详细

implementer.cpp: In function ‘int _JFIBEIIYTAFEUXOULOWO_::main()’:
implementer.cpp:31:22: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions]
   31 |                 auto [A,x,y,z]=V[i];
      |                      ^
implementer.cpp:36:18: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions]
   36 |         for(auto [A,x,y]:U)
      |                  ^
implementer.cpp:39:22: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions]
   39 |                 auto [A,x,y,z]=V[i];
      |                      ^
implementer.cpp:18:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   18 |         scanf("%d%d%d%d",&N,&Type,&p,&T);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
implementer.cpp:23:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   23 |                 scanf("%llu",&x);
      |                 ~~~~~^~~~~~~~~~~
answer.code: In function ‘bool guess(long long unsigned int, int)’:
answer.code:43:16: error: declaration of ‘double x’ shadows a parameter
   43 |         double x=0,y=0;
      |                ^
answer.code:42:37: note: ‘int x’ previously declared here
   42 | bool guess(unsigned long long A,int x){
      |                                 ~~~~^
answer.code:45:23: error: ‘n’ was not declared in this scope
   45 |         for(int i=1;i<n;i++){
      |                       ^