Alice Sieve
Link to the question : ALICESIE
HINT :
A very simple question. The algorithm is based on Hit and Trial approach. Just solve for a few odd numbers and some even numbers, you will get to know how it is done and what to do.
SOURCE CODE :
#include <stdio.h>
int main()
{
int t,n;
scanf("%d", &t);
while(t--)
{
scanf("%d", &n);
if(n%2)
printf("%d\n",(n+1)/2);
else
printf("%d\n",n/2);
}
return 0;
}
No comments:
Post a Comment