i can't ac it,i don't know why.
my code:
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<queue>
#include<stack>
#include<map>
using namespace std;
int main() {
int t;
cin >> t;
while(t--){
int n;
cin >> n;
if(n%2==1){
cout<<n/2+1<<endl;
int m = (n-1)*3;
int i = 6;
for(;i<=m;i+=6){
cout<< i-5<<" "<<i<<endl;
}
cout<< m+1<<" "<<m+3<<endl;
}
else {
cout<<n/2<<endl;
int i = 6;
for(;i<=n*3;i+=6){
cout<< i-5<<" "<<i<<endl;
}
}
}
return 0;
}
Standard answer code:
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<queue>
#include<stack>
#include<map>
using namespace std;
int main() {
int t;
cin >> t;
while(t--){
int n;
cin >> n;
cout<<n/2+n%2<<endl;
int l = 1, r = 3*n;
while(l < r){
cout << l << " " << r << endl;
l += 3;
r -= 3;
}
}
return 0;
}