Wrong Answer
/in/foo.cc: In function 'int main()': /in/foo.cc:38:21: warning: 'ans' may be used uninitialized in this function [-Wmaybe-uninitialized] cout<<num<<" "<<ans; ^
代码
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
int a,b,c;
cin>>n;
int ans;
a=1;
int c1b;
int num=0;
for(int b=1; a+b+b<=n; b++)
{
c=b;
if(num==0)
ans=(a+b)^c;
else
ans^=(a+b)^c;
num++;
}
b=a;
c=a;
for(a=2; a+b+c<=n; a++)
{
for(int cb=1; cb<=a*a-1; cb++)
{
if(a<=b&&b<=c)
{
c1b=a*a-1/cb;
c=(c1b+cb)/2;
b=(c1b-cb)/2;
ans^=(a+b)^c;
num++;
}
}
}
cout<<num<<" "<<ans;
}
信息
- 递交者
- 类型
- 递交
- 题目
- P1003 hitwh 2019 新生赛 D Songer 的排兵布阵
- 语言
- C++
- 递交时间
- 2020-12-18 11:12:29
- 评测时间
- 2020-12-18 11:12:29
- 评测机
- 分数
- 30
- 总耗时
- 19ms
- 峰值内存
- 232.0 KiB