static void Main(string[] args) { int n, m, i, sum, answer; int[] t, p, x, buff; n = int.Parse(Console.ReadLine()); t = MYCP.Read_Ints(n); m = int.Parse(Console.ReadLine()); p = new int[m]; x = new int[m]; for (i = 0; i < m; i++) { buff = MYCP.Read_Ints(2); p[i] = buff[0]; x[i] = buff[1]; } sum = 0; for (i = 0; i < n; i++) { sum += t[i]; } for (i = 0; i < m; i++) { answer = sum; answer -= t[p[i] - 1]; answer += x[i]; Console.WriteLine(answer); } }
static void Main(string[] args) { int number = int.Parse(Console.ReadLine()); int[] a = new int[number]; int i, j, k, count; for (i = 1; i < 5; i++) { count = 0; for (j = 0; j + i <= 55555; j += 5) { if (MYCP.PrimeCheck(j + i)) { a[count] = j + i; count++; if (count == number) { MYCP.PrintNumbers(a); return; } } } } }
static void Main(string[] args) { char[] str = Console.ReadLine().ToCharArray(); int count_pa = 0; int max; int i; for (i = 0; i < str.Length; i++) { if (str[i] == 'p') { count_pa++; } } max = str.Length / 2; MYCP.Print_Int(max - count_pa); }