-
Notifications
You must be signed in to change notification settings - Fork 0
/
candy_bag1.cpp
49 lines (48 loc) · 914 Bytes
/
candy_bag1.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
int a[101];
int count=0;
int b[101];
int temp=n*n;
int start=1;
cout<<start<<" ";
++count;
//for(int i=1;i<=temp;++i) {
while(1) {
cout<<start+3<<" ";
start=start+3;
++count;
if(count==n) break;
cout<<start+1<<" ";
start+=1;
++count;
if(count==n) break;
cout<<start+3<<" ";
start+=3;
++count;
if(count==n) break;
}
count=0;
cout<<endl;
start=2;
cout<<start<<" ";
++count;
while(1) {
cout<<start+1<<" ";
start=start+1;
++count;
if(count==n) break;
cout<<start+3<<" ";
start+=3;
++count;
if(count==n) break;
cout<<start+1<<" ";
start+=1;
++count;
if(count==n) break; }
return 0;
}