Problem 1:- CodeChef: Practical coding for everyone
#include
using namespace std;
int main() {
int T;cin>>T;
int p;
while(T–){
int N;
cin>>N;
if(N==1){
p=1;
}
else{
p = (N+1)/2;
}
cout<<p<<endl;
}
return 0;
}
Input:
2
1
3
Output:
1
2
- Test Case 2: (Self-Created)
Input:
3
1
3
7
Output:
1
2
4
Please see how to write code in the comment /discussion section.
And bro please note that this question does not require you to do anything, simply you have to observe that ans will be (x/2)+1;
Always enclose your code in ``` ticks
like this
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll t;
cin>>t;
while(t--)
{
ll x;
cin>>x;
cout<<(x/2)+1<<"\n";
}
}
1 Like
Hi, ms. Shobha Kumari, why is your solution for NUMCOMP1 matching with other solutions?
Your Submission: CodeChef: Practical coding for everyone
Someone else’s submission: CodeChef: Practical coding for everyone
Coolest Participant who topped May Long Challenge 2021 Division 2 with a global rank of 1.
Eagerly waiting for that black triangle to appear on your profile page 
Thanks man, i am very new to this platform so just i thought it would be a good help for beginners too.
Appreciating your help.