Skip to content

Instantly share code, notes, and snippets.

@ik11235

ik11235/a.cpp

Created Jan 3, 2015
Embed
What would you like to do?
#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