1 solutions
-
0
C :
#include<stdio.h> int main() { int i,j,t,k=0,x[20]={1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765}; while(scanf("%d",&i)==1) { t=0;printf("\n"); while(t<=19) { for(j=1;j<=i;j++) { printf("%6d",x[t++]); if(t==20)break; } printf("\n"); } } }C++ :
#include <bits/stdc++.h> using namespace std; int main() { int n; int a[25]={1,1,2,3,5,8 , 13 , 21 , 34,55,89 , 144 , 233 , 377 , 610,987 , 1597 , 2584 , 4181 , 6765}; while(~scanf("%d",&n)){ printf("\n"); for (int i=1;i<=20;i++){ printf("%6d",a[i-1]); if (i%n==0&&i>=n){ printf("\n"); } } if (20%n!=0) printf("\n"); } return 0; }
- 1
Information
- ID
- 18308
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By