codeforces 334A - Candy Bags
忘了是偶数了,在纸上画奇数画了半天。。。
1 #include<cstdio> 2 #include<cstring> 3 #include<cstdlib> 4 #include<cmath> 5 #include<algorithm> 6 using namespace std; 7 8 #define LL __int64 9 10 int vis[11111]; 11 12 int main() 13 { 14 int n,i,j,tot; 15 scanf("%d",&n); 16 j=1; 17 for(i=0;i<n;i++) 18 { 19 int tot=0; 20 while(1) 21 { 22 printf("%d %d ",j,n*n-j+1); 23 j++; 24 tot++; 25 if(tot>=n/2) 26 break; 27 } 28 printf("\n"); 29 } 30 return 0; 31 }