Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Iran
- {
- class Amir
- {
- public static void Main()
- {
- string[] input=Console.ReadLine().Split(' ');
- int n=int.Parse(input[0]);
- int b=int.Parse(input[1]);
- int maximum=b;
- string[] dollars=Console.ReadLine().Split(' ');
- for(int i=0;i<n;i++)
- {
- for(int j=i;j<n;j++)
- {
- int canbuy=b/int.Parse(dollars[i]);
- int more=b%int.Parse(dollars[i]);
- int sell=canbuy*int.Parse(dollars[j])+more;
- if(sell>maximum)
- maximum=sell;
- }
- }
- Console.WriteLine(maximum);
- }//end of main
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement