URI / BEE CROWD 1145 - Logical Sequence 2 - Solution in C,C++,Python | URI - BEECROWD - BEE 1145 Solution in C,C++,Python

URI / BEE CROWD 1145 - Logical Sequence 2 - Solution in C,C++,Python | URI - BEECROWD - BEE 1145 Solution in C,C++,Python

                                                                                             beecrowd | 1145

Logical Sequence 2

Adapted by Neilor Tonin, URI  Brazil

                                                                                             Timelimit: 1


URI / BEE CROWD 1145 - Logical Sequence 2 - Solution in C,C++,Python | URI - BEECROWD - BEE 1145 Solution in C,C++,Python:

Write a program that reads an integer N. N * 2 lines must be printed by this program according to the example below. For numbers with more than 6 digits, all digits must be printed (no cientific notation allowed).

Input

The input file contains an integer N (1 < N < 1000).

Output

Print the output according to the given example.

Input SampleOutput Sample

5

1 1 1
1 2 2
2 4 8
2 5 9
3 9 27
3 10 28
4 16 64
4 17 65
5 25 125
5 26 126

N.B: Don't copy paste the code as same. Just try to understand it and try yourself.

  URI / BEE 1145 Solution in C :   

  URI / BEECROWD Online Judge 1145 Solve  in C :                                          

#include <stdio.h>
int main()
{
    int n,a,b,i,j,k,l,m=1;
    scanf("%d %d",&a,&n);
    k=n/a;
    l=a;
    for(i=1;i<=k;i++)
	{
		printf("%d",m);
		for(j=m+1;j<=l;j++)
		{
			printf(" %d",j);
		}
		printf("\n");
		m=m+a;
		l=l+a;
	}

    return 0;
}

0 Response to URI / BEE CROWD 1145 - Logical Sequence 2 - Solution in C,C++,Python | URI - BEECROWD - BEE 1145 Solution in C,C++,Python

Post a Comment