1ms C code. Cannot be more consice. Why my eyes are filled with tears (╯▽╰)


  • -1
    Y

    #Firstly,I wrote this code:

    #include<stdio.h>
    #include<stdlib.h>
    #include<string.h>
    int a[101][101]={0};
    int main()
    {
    	freopen("output.txt","w",stdout);
    	a[1][0]=1;
    	a[1][1]=1;
    	for(int i=1;i<101;i++){
    		for(int j=1;j<101;j++){
    			a[i][j]=a[i][j-1]+a[i-1][j];
    		}
    	}
    
    	for(int i=0;i<101;i++){
    		printf("{");
    		for(int j=0;j<i+1;j++){
    			if(a[i][j]<0)
    				break;
    			printf("%d,",a[i][j]);
    		}
    		printf("},\n");
    	}
    }
    

    #Mmm... Then copy some strange thing from my output.txt file.

    (╯3╰)

    #I just want to be a quiet coder...

        int table[101][101] = 
        {
        	{0,},
        	{1,1,},
        	{0,1,2,},
        	{0,1,3,6,},
        	{0,1,4,10,20,},
        	{0,1,5,15,35,70,},
        	{0,1,6,21,56,126,252,},
        	{0,1,7,28,84,210,462,924,},
        	{0,1,8,36,120,330,792,1716,3432,},
        	{0,1,9,45,165,495,1287,3003,6435,12870,},
        	{0,1,10,55,220,715,2002,5005,11440,24310,48620,},
        	{0,1,11,66,286,1001,3003,8008,19448,43758,92378,184756,},
        	{0,1,12,78,364,1365,4368,12376,31824,75582,167960,352716,705432,},
        	{0,1,13,91,455,1820,6188,18564,50388,125970,293930,646646,1352078,2704156,},
        	{0,1,14,105,560,2380,8568,27132,77520,203490,497420,1144066,2496144,5200300,10400600,},
        	{0,1,15,120,680,3060,11628,38760,116280,319770,817190,1961256,4457400,9657700,20058300,40116600,},
        	{0,1,16,136,816,3876,15504,54264,170544,490314,1307504,3268760,7726160,17383860,37442160,77558760,155117520,},
        	{0,1,17,153,969,4845,20349,74613,245157,735471,2042975,5311735,13037895,30421755,67863915,145422675,300540195,601080390,},
        	{0,1,18,171,1140,5985,26334,100947,346104,1081575,3124550,8436285,21474180,51895935,119759850,265182525,565722720,1166803110,},
        	{0,1,19,190,1330,7315,33649,134596,480700,1562275,4686825,13123110,34597290,86493225,206253075,471435600,1037158320,},
             ......
            [too many numbers, I delete some lines. You know the method...]
        
        };
        int uniquePaths(int m, int n) {
        	if(m>n)
        		return table[m][n];
        	else
        		return table[n][m];
        }

  • 0
    L

    you're crazy....233


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.