[ create a new paste ] login | about

Link: http://codepad.org/9muxzzd7    [ raw code | output | fork ]

C, pasted on Oct 18:
#include<stdio.h>
#include<conio.h>

int main()
{

	int score;
	int maxnote;
	int maxcb;
	int cbg;
	scanf("%d %d",&score,&maxcb);
	maxnote=maxcb;
	for(int k=maxnote;k<2001;k++)
	{
		float ppn=900000/(float)k;
		float pcb=200000/(float)k/(float)(k-1);
		float crr=maxcb*ppn+pcb*maxcb*(maxcb-1)/2;
		for (int i=1;i<=k-maxcb;i++)
			{
				cbg=i*(i-1)/2;
				for (int j=1;j<=k-i-maxcb;j++)
				if ((int)(crr+(i+j)*ppn+cbg*pcb)==score&&i<=maxcb)
				printf("length: %d combo: %d single: %d\n",k,i,j);
			}
	}
	getch();
} 


Output:
1
2
3
4
5
Line 17: error: conio.h: No such file or directory
In function 'main':
Line 13: error: 'for' loop initial declaration used outside C99 mode
Line 18: error: 'for' loop initial declaration used outside C99 mode
Line 21: error: 'for' loop initial declaration used outside C99 mode


Create a new paste based on this one


Comments: