Rezultati

Up. imeNalogaJezikRezultatČas oddaje
PIN Akcija C++ 100/100OK 20. apr '17 @ 18:58

Test Točke Porabljen spomin Porabljen čas Status
#1 7/7 3,234 MiB 0,004 s OK
#2 7/7 3,242 MiB 0,004 s OK
#3 7/7 3,250 MiB 0,004 s OK
#4 7/7 3,238 MiB 0,043 s OK
#5 8/8 3,250 MiB 0,316 s OK
#6 8/8 3,250 MiB 0,323 s OK
#7 8/8 3,250 MiB 0,340 s OK
#8 8/8 3,250 MiB 0,328 s OK
#9 8/8 3,242 MiB 0,322 s OK
#10 8/8 3,242 MiB 0,334 s OK
#11 8/8 3,242 MiB 0,328 s OK
#12 8/8 3,242 MiB 0,346 s OK
#13 8/8 3,250 MiB 0,004 s OK

Ocenjevani program (sale.cpp):
#include <iostream>
#include <vector>
#include <math.h>
#include <string>
#include <stdio.h>

using namespace std;

int getMonthNr(const string &month)
{
    if(month == "januar") return 1;
    if(month == "februar")return 2;
    if(month == "marec") return 3;
    if(month == "april") return 4;
    if(month == "maj") return 5;
    if(month == "junij") return 6;
    if(month == "julij") return 7;
    if(month == "avgust") return 8;
    if(month == "september") return 9;
    if(month == "oktober") return 10;
    if(month == "november") return 11;
    if(month == "december") return 12;
}

int getDaysNr(int day, int month)
{
    if(month < 4)
    {
        return 0;
    }

    if(month == 4 && day < 20)
    {
        return 0;
    }

    if(month == 4)
    {
        return day - 19;
    }

    int days = 11;

    int daysInMonth[13];
    daysInMonth[0] = daysInMonth[1] = daysInMonth[2] = daysInMonth[3] = daysInMonth[4] = 0;
    daysInMonth[5] = 31;
    daysInMonth[6] = 30;
    daysInMonth[7] = 31;
    daysInMonth[8] = 31;
    daysInMonth[9] = 30;
    daysInMonth[10] = 31;
    daysInMonth[11] = 30;
    daysInMonth[12] = 31;

    for(int i = 5; i < month; i++)
    {
        days += daysInMonth[i];
    }

    return days + day;
}

int main()
{    
    int n;
    cin >> n;

    int items, day, year;
    double doubleDay;
    double averageSale;
    string month;


    int x,y;

    for(int i = 0; i < n; i++)
    {
        cin >> items;
        scanf("%d.%d", &x, &y);
        cin >> doubleDay;
        cin >> month;
        cin >> year;

        day = (int)doubleDay;
        int monthNr = getMonthNr(month);

  //      cout << items << " " << x << "." << y << " " << day << " " << monthNr << " " << year << endl;

        int daysNr = getDaysNr(day, monthNr);

//cout << daysNr << endl;

        if(daysNr == 0)
        {
            cout << "V SMETI" << endl;
            continue;
        }

        double possibleSell = daysNr * x + (daysNr * y) / 100;


        if(possibleSell < items)
        {
            cout << "AKCIJA" << endl;
        }
        else
        {
            cout << "OK" << endl;
        }

    }

    return 0;
}