Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /******************************************************************************
- Resti - calcolo
- *******************************************************************************/
- #include <stdio.h>
- #define M 300
- #define C 210
- #define G 10000
- int main()
- {
- int m,c;
- int err = 2000 ;
- int mm,cc;
- for (m=5; m<G; m++){
- for (c =2; c<G; c++)
- if (m*M - c*C > 1000){
- if (m*M - c*C < err) {
- err = m*M - c*C;
- mm = m;
- cc = c;
- }
- }
- else if (c*C - m*M > 1000){
- if (c*C - m*M < err) {
- err = c*C - m*M ;
- mm = m;
- cc = c;
- }
- }
- }
- printf ("MAIALI %d CAPRE %d RES %d \n\n",mm,cc,err);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement