using System namespace scratch class Program static void Main string a

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using System;
namespace scratch
{
class Program
{
static void Main(string[] args)
{
double money = 0;
string destination2;
while ((destination2 = Console.ReadLine()) != "End")
{
double sum = double.Parse(Console.ReadLine());
while (money <= sum)
{
double money2 = double.Parse(Console.ReadLine());
money += money2;
if (money >= sum)
{
Console.WriteLine($"Going to {destination2}!");
break;
}
}
money = 0;
}
}
}
}