Skip to content

Instantly share code, notes, and snippets.

@ik11235
Created January 3, 2015 14:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ik11235/fa33d221cb44ffbc9733 to your computer and use it in GitHub Desktop.
Save ik11235/fa33d221cb44ffbc9733 to your computer and use it in GitHub Desktop.
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
const int MAX= 1000*1001/2;
bool prime[MAX+1];
memset(prime,true,sizeof(prime));
prime[0]=prime[1]=false;
for(int i=2;i<=MAX;i++)
{
if(prime[i])
for(int j=i+i;j<=MAX;j+=i)
prime[j]=false;
}
int n;
cin>>n;
if(prime[n*(n+1)/2])
cout<<"WANWAN"<<endl;
else
cout<<"BOWWOW"<<endl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment