Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace _2.NightmareOnCodeStreet
- {
- using System;
- using System.Collections.Generic;
- using System.Linq;
- public class NightmareOnCodeStreet
- {
- public static void Main(string[] args)
- {
- checked
- {
- string inputText = Console.ReadLine();
- string[] symbols = new string[inputText.Length];
- for (int i = 0; i < symbols.Length; i++)
- {
- symbols[i] = inputText[i].ToString();
- }
- int countOdds = 0;
- long sumOdds = 0;
- for (int i = 0; i < symbols.Length; i++)
- {
- bool isDigit = false;
- byte digit;
- if (byte.TryParse(symbols[i], out digit))
- {
- isDigit = true;
- }
- if (isDigit && (i % 2) != 0)
- {
- sumOdds += digit;
- countOdds++;
- }
- }
- Console.WriteLine("{0} {1}", countOdds, sumOdds);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement