记录详情

Compile Error

/in/foo.c: In function 'main':
/in/foo.c:15:26: error: 'b' undeclared (first use in this function)
    if(!(a*a-1)%(i-a)&&(a+b+c)==i)
                          ^
/in/foo.c:15:26: note: each undeclared identifier is reported only once for each function it appears in
/in/foo.c:15:28: error: 'c' undeclared (first use in this function)
    if(!(a*a-1)%(i-a)&&(a+b+c)==i)
                            ^
/in/foo.c: At top level:
/in/foo.c:37:9: error: expected declaration specifiers or '...' before string constant
  printf("%d %d",num,r);
         ^~~~~~~
/in/foo.c:37:17: error: unknown type name 'num'
  printf("%d %d",num,r);
                 ^~~
/in/foo.c:37:21: error: unknown type name 'r'
  printf("%d %d",num,r);
                     ^
/in/foo.c:38:2: error: expected identifier or '(' before 'return'
  return 0; 
  ^~~~~~
/in/foo.c:39:1: error: expected identifier or '(' before '}' token
 }
 ^

代码

#include<stdio.h>
int main()
{
	int n=0;
	
	int num=0;
	
	int r=3;
	
	scanf("%d",&n);
	for(int i=3;i<=n;i=i+2)
	{
		for(int a=1;a<=i/3;a++)
		{
			if(!(a*a-1)%(i-a)&&(a+b+c)==i)
			{
				int t=(a*a-1)/(i-a);
				
				int b=(i-t-a)/2;
				
				int c=(t+i-a)/2;
			
				num++;	
				
				if(a==1&&b==1&&c==1);
				
				else
				{
					r=r^((a+b)^c);
				}	
			}
				
			}
			
		}
	}
	printf("%d %d",num,r);
	return 0;	
} 

信息

递交者
类型
递交
题目
P1003 hitwh 2019 新生赛 D Songer 的排兵布阵
语言
C
递交时间
2020-12-24 18:50:57
评测时间
2020-12-24 18:50:57
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes