Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as Plain Text by SWAGGABOY 7 EX ( 11 years ago )
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>

using namespace std;

int main()
{
 freopen("input.txt", "r", stdin);
 freopen("output.txt", "w", stdout);
 int n, TEMP[500], Premiya[500], Payday[500], t, a,b, S;
 cin >> n;

 // Фигня
 for (int i = 0; i < 500; i++)
 {
  Payday[i] = 0;
  Premiya[i] = 0;
 }
 // Фигня

 for (int i = 0; i < n; i++)
 {
  cin >> TEMP[i];
 }
 cin >> t;
 for (int i = 0; i < t; i++)
 {
  cin >> a;
  if (a == 1)
  {
   for (int j = 0; j < n;j++)
    Payday[j] +=TEMP[j];
  }
  else
  if (a == 2)
  {
   cin >> b;
   for (int j = 0; j < n; j++)
    Premiya[j] += b;
  }
  else
  if (a == 3)
  {
   S = 0;
   for (int j = 0; j < n; j++)
   {
    if (Premiya[j] < Payday[j])
     S++;
   }
   cout << S << endl;
  }
 }
 return 0;
}

 

Revise this Paste

Parent: 77157
Your Name: Code Language: