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;
- using System.Threading.Tasks;
- namespace Salt_and_Pepper
- {
- class Program
- {
- static void Main(string[] args)
- {
- var dishes = ulong.Parse(Console.ReadLine());
- string commands = Console.ReadLine();
- while (commands != "end")
- {
- string[] words = commands.Split(' ');
- var spice = words[0];
- var step =int.Parse(words[1]);
- if (spice == "pepper")
- {
- for (int i = 0; i < 64; i+=step)
- {
- dishes |= (ulong)1 << i;
- }
- }
- if (spice == "salt")
- {
- for (int i = 0; i < 64; i+=step)
- {
- dishes &= ~((ulong)1 << i);
- }
- }
- commands = Console.ReadLine();
- }
- Console.WriteLine(dishes);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment