Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class Printing
- {
- static void Main()
- {
- int M = int.Parse(Console.ReadLine());
- String str = Console.ReadLine();
- long result = 0;
- foreach (var ch in str)
- {
- if (ch == '@')
- {
- break;
- }
- else if (ch >= 'a' && ch <= 'z')
- {
- result = result + (ch - 'a');
- }
- else if (ch >= 'A' && ch <= 'Z')
- {
- result = result + (ch - 'A');
- }
- else if (ch >= '0' && ch <= '9')
- {
- result = result * (ch - '0');
- }
- else
- {
- result = result % M;
- }
- }
- Console.WriteLine(result);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement