SHOW:
|
|
- or go back to the newest paste.
| 1 | #include <stdio.h> | |
| 2 | - | #include<stdlib.h> |
| 2 | + | |
| 3 | - | #include<string.h> |
| 3 | + | |
| 4 | - | struct t{
|
| 4 | + | struct{int carry;int times;} list[] = { {0,0}, {20,3}, {40,6}, {60,9}, {10,2}, {30,5}, {50,8}, {0,1}, {20,4}, {40,7} };
|
| 5 | - | int carry; |
| 5 | + | |
| 6 | - | int times; |
| 6 | + | |
| 7 | - | }; |
| 7 | + | int target = strtol( in, 0, 10 ), j, i,save[4]; |
| 8 | - | int getfirst(int a){
|
| 8 | + | |
| 9 | - | return a - a / 10 * 10; |
| 9 | + | j = target - target / 10 * 10; |
| 10 | - | } |
| 10 | + | |
| 11 | target = ( target - list[j].carry ) / 10; | |
| 12 | } | |
| 13 | - | struct t list[] = { {0,0}, {20,3}, {40,6}, {60,9}, {10,2}, {30,5}, {50,8}, {0,1}, {20,4}, {40,7} };
|
| 13 | + | for( i = 0; i < 4; ++i ) |
| 14 | - | int save[4]; |
| 14 | + | printf("%i%c", save[i], i < 3 ? '>' : ' ' );
|
| 15 | } |