Skip to content

Commit 5f4d8cd

Browse files
authored
Create TRAVERSE.cpp
1 parent 067ebd4 commit 5f4d8cd

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

Codeshef/TRAVERSE.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#include <stdio.h>
2+
using namespace std;
3+
int main()
4+
{
5+
int t;
6+
scanf("%d",&t);
7+
while(t--){
8+
long long int M=0,x=0,y=0,common=0,rem=0;
9+
scanf("%lld",&M);
10+
common= M/3;
11+
rem=M%3;
12+
x=common;
13+
y=2*common;
14+
if(rem==1){
15+
x++;
16+
}
17+
if(rem==2){
18+
x++;
19+
y++;
20+
}
21+
printf("%lld %lld\n",x,y);
22+
}
23+
return 0;
24+
}

0 commit comments

Comments
 (0)