Rezultati

Up. imeNalogaJezikRezultatČas oddaje
lisperator-2017 Akcija C++ 100/100OK 20. apr '17 @ 16:58

Test Točke Porabljen spomin Porabljen čas Status
#1 7/7 3,121 MiB 0,004 s OK
#2 7/7 3,121 MiB 0,004 s OK
#3 7/7 3,133 MiB 0,004 s OK
#4 7/7 3,129 MiB 0,049 s OK
#5 8/8 3,121 MiB 0,438 s OK
#6 8/8 3,125 MiB 0,432 s OK
#7 8/8 3,129 MiB 0,444 s OK
#8 8/8 3,133 MiB 0,426 s OK
#9 8/8 3,121 MiB 0,438 s OK
#10 8/8 3,121 MiB 0,456 s OK
#11 8/8 3,125 MiB 0,438 s OK
#12 8/8 3,129 MiB 0,444 s OK
#13 8/8 3,133 MiB 0,004 s OK

Ocenjevani program (Source (6).cpp):
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
using namespace std;

int months[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
int name_to_index(string name)
{
	if (name == "januar")
		return 0;
	if (name == "februar")
		return 1;
	if (name == "marec")
		return 2;
	if (name == "april")
		return 3;
	if (name == "maj")
		return 4;
	if (name == "junij")
		return 5;
	if (name == "julij")
		return 6;
	if (name == "avgust")
		return 7;
	if (name == "september")
		return 8;
	if (name == "oktober")
		return 9;
	if (name == "november")
		return 10;
	if (name == "december")
		return 11;

	return -1;
}

int main()
{
	int N;
	cin >> N;
	long long stock, day, month, year;
	string day_str;
	string month_str;
	string rate_str;
	string year_str;
	long long rate;
	int today = 90 + 20;

	for (int i = 0; i != N; i++)
	{
		cin >> stock;
		stock *= 100;
		cin >> rate_str;
		cin >> day_str;
		cin >> month_str;
		cin >> year_str;
		stringstream ss;

		int whole, decimal;
		string whole_str = rate_str.substr(0, rate_str.size() - 3);
		string decimal_str = rate_str.substr(rate_str.size() - 2, rate_str.size());
		ss << whole_str;
		ss >> whole;
		ss = stringstream();
		ss << decimal_str;
		ss >> decimal;
		ss = stringstream();

		rate = whole * 100 + decimal;


		
		day_str = day_str.substr(0, day_str.size() - 1);
		ss << day_str;

		ss >> day;

		month = name_to_index(month_str);
		int expiry = 0;
		for (int j = 0; j != month; j++)
		{
			expiry += months[j];
		}
		expiry += day;

		int day_diff = expiry - today + 1;
		if (day_diff <= 0)
			cout << "V SMETI" << endl;
		else if (stock <= day_diff * rate)
			cout << "OK" << endl;
		else
			cout << "AKCIJA" << endl;
		
	}


	//system("pause");

	return 0;
}