Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace PuzzleSolver{
- class program{
- struct t{
- public int carry, times;
- public t( int c, int t ){
- carry = c; times = t;
- }
- };
- static void Main( string[] args ){
- t[] list = { new t(0,0), new t(20,3), new t(40,6), new t(60,9), new t(10,2), new t(30,5), new t(50,8), new t(0,1), new t(20,4), new t(40,7) };
- Console.Write("Target: ");
- String inp = Console.ReadLine();
- int target = Convert.ToInt32( inp );
- int j, i;
- int[] save = new int[4];
- for( i = 3; i >= 0; --i ){
- j = target - target / 10 * 10;
- save[i] = list[j].times;
- target = ( target - list[j].carry ) / 10;
- }
- for( i = 0; i < 4; ++i )
- Console.Write("{0}{1}", save[i], i < 3 ? '>' : ' ' );
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement