Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
"并行"求解#include <stdio.h> void print(int n) { int start=n/2; for(int i=1;i<=n/2;i++,start--){ printf("%d %d %d\n",start,2,n-i-1); } printf("%d %d %d\n", (n&1)? 2:1,n/2,(n+1)/2); } int main() { int n; while(scanf("%d",&n)!=EOF){ if(n==1){ puts("0"); continue; } if(n==2){ puts("1"); puts("1 1 1"); continue; } printf("%d\n",n/2+1); print(n); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator