Advertisement
Graf_Rav

myExam2

Jun 13th, 2018
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.86 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. public static class Program{
  5.     public static void Main(){
  6.         int n;
  7.         n=int.Parse(Console.ReadLine());
  8.        
  9.         Queue<int> q = new Queue<int>();
  10.         int k1=0, k13=0;
  11.         int a;
  12.         int ans=0;
  13.        
  14.         for(int i=0;i<3;i++){
  15.             a=int.Parse(Console.ReadLine());
  16.             q.Enqueue(a);
  17.         }
  18.        
  19.         for(int i=3;i<n;i++){
  20.             if(q.Peek()%13==0){
  21.                 k13++;
  22.             }
  23.             else{
  24.                 k1++;
  25.             }
  26.            
  27.             a=int.Parse(Console.ReadLine());
  28.            
  29.             if(a%13==0){
  30.                 ans+=k1+k13;
  31.             }
  32.             else{
  33.                 ans+=k13;
  34.             }
  35.            
  36.             q.Dequeue();//убираю 1 элемент очереди
  37.             q.Enqueue(a);//добавляю а
  38.         }
  39.        
  40.         Console.WriteLine(ans);
  41.     }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement