Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- public static class Program{
- public static void Main(){
- int n;
- n=int.Parse(Console.ReadLine());
- Queue<int> q = new Queue<int>();
- int k1=0, k13=0;
- int a;
- int ans=0;
- for(int i=0;i<3;i++){
- a=int.Parse(Console.ReadLine());
- q.Enqueue(a);
- }
- for(int i=3;i<n;i++){
- if(q.Peek()%13==0){
- k13++;
- }
- else{
- k1++;
- }
- a=int.Parse(Console.ReadLine());
- if(a%13==0){
- ans+=k1+k13;
- }
- else{
- ans+=k13;
- }
- q.Dequeue();//убираю 1 элемент очереди
- q.Enqueue(a);//добавляю а
- }
- Console.WriteLine(ans);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement