Home > Back-end >  Yang hui triangle, bosses help to see where is wrong, thank you very much!!!!!
Yang hui triangle, bosses help to see where is wrong, thank you very much!!!!!

Time:11-23

#include
Int main ()
{
Int I, j, t, k;
t=1; K=1;

Int a [10] [10].
A [1] [1]=1;
Printf (" % d ", t);
for(i=1; i<10; I++ k++)
{printf (" % d ", t);
for(j=1; (j>=1) & amp; & (j{if (j==1) a [I] [j]=t + a, [I - 1) [j].
Else if (j)==k - 1 a [I] [j]=t + a [I - 1] [1].
Else a [I] [j]=[I - 1] a [j - 1) + a, [I - 1) [j].
Printf (" % 5 d ", a, [I] [j]. }
Printf (" % 5 d, t); }}

CodePudding user response:

You this is not a newline and fill the blank space
A [1] [1]=1;
Printf (" % d \ n ", t);//here to break

Printf (" % 5 d \ n, t); }}//here to break

As to fill the blank space, LZ to adjust yourself

CodePudding user response:

reference 1st floor qybao response:
you this is not a newline and fill the blank space
A [1] [1]=1;
Printf (" % d \ n ", t);//here to break

Printf (" % 5 d \ n, t); }}//here to break

As to fill the blank space, LZ to adjust yourself

Thank you thank you, there is a [] [] the statement have to put in the plastic definition above, these small problems, very afflictive, can not find out??

CodePudding user response:

Fyi:
 # include & lt; stdio.h> 
# define MAXN 10
Unsigned __int64 y [MAXN] [MAXN];
int i,j;
Char s [60];
Void main () {
Printf (" % s \ n 30 ", "1");
Printf (" % s \ n 33 ", "1 1");
Ui64 y [1] [0]=1; Ui64 y [1] [1]=1;
For (I=2; iY ui64 [I] [0]=1; Sprintf (s, "1");
For (j=1; j<=I - 1; J++) {
[I] [j] y=y [I - 1] [1] + [j] [I - 1] y;
Sprintf (s, "% s % 3 i64u", s, y [I] [j]);
}
[I] [I] y=1 ui64; 1 sprintf (s, "% s", s);
* printf (" % s \ n ", 30 + I * 3, s);
}
}
//1
//1 1
//1 2 1
//1 3 3 1
//1 4 6 4 1
//5 10 10 1
//1 6 15 20 15 1
//1 July 21 35 35 21 July 1
//1 August 28 56, 70, 56, 28 August 1
//1 9 36 84 126 126 84 36 9 1

Again for reference:
//according to the following format to print the first MAXN lines of Yang hui triangle, 
//1
//1 1
//1 2 1
//1 3 3 1
//1 4 6 4 1
//5 10 10 1
#include
# define MAXN 68
Unsigned __int64 y [MAXN] [MAXN];
int i,j;
Void main () {
Printf (" 1 \ n ");
Printf (" 1 1 \ n ");
Ui64 y [1] [0]=1; Ui64 y [1] [1]=1;
For (I=2; iY ui64 [I] [0]=1; Printf (" 1 ");
For (j=1; j<=I - 1; J++) {
[I] [j] y=y [I - 1] [1] + [j] [I - 1] y;
Printf (" % I64u ", y [I] [j]);
}
[I] [I] y=1 ui64; Printf (" 1 \ n ");
}
}
//1
//1 1
//1 2 1
//1 3 3 1
//1 4 6 4 1
//5 10 10 1
//1 6 15 20 15 1
//1 July 21 35 35 21 July 1
//1 August 28 56, 70, 56, 28 August 1
//1 9 36 84 126 126 84 36 9 1
//...
//1 67 2211 47905 766480 9657648 99795696 869648208 6522361560 42757703560 247994680648 1285063345176 5996962277488 25371763481680 97862516286480 345780890878896 1123787895356412 3371363686069236 9364899127970100 24151581961607100 57963796707857040 129728497393775280 271250494550621040 530707489338171600 972963730453314600 1673497616379701112 2703342303382594104 4105075349580976232 5864393356544251760 7886597962249166160 9989690752182277136 11923179284862717872 13413576695470557606 14226520737620288370 14226520737620288370 13413576695470557606 11923179284862717872 9989690752182277136 7886597962249166160 5864393356544251760 4105075349580976232 2703342303382594104 1673497616379701112 972963730453314600 530707489338171600 271250494550621040 129728497393775280 57963796707857040 24151581961607100 9364899127970100 3371363686069236 1123787895356412 345780890878896 97862516286480 25371763481680 5996962277488 1285063345176 247994680648 42757703560 6522361560 869648208 99795696 9657648 766480 47905 2211 67 1
  • Related