Rezultati

Up. imeNalogaJezikRezultatČas oddaje
fedja-2017 Akcija C++ 100/100OK 20. apr '17 @ 18:02

Test Točke Porabljen spomin Porabljen čas Status
#1 7/7 3,004 MiB 0,004 s OK
#2 7/7 3,180 MiB 0,004 s OK
#3 7/7 3,004 MiB 0,004 s OK
#4 7/7 3,000 MiB 0,010 s OK
#5 8/8 3,184 MiB 0,026 s OK
#6 8/8 3,004 MiB 0,020 s OK
#7 8/8 3,172 MiB 0,026 s OK
#8 8/8 2,996 MiB 0,026 s OK
#9 8/8 3,172 MiB 0,026 s OK
#10 8/8 3,180 MiB 0,032 s OK
#11 8/8 3,176 MiB 0,026 s OK
#12 8/8 3,000 MiB 0,026 s OK
#13 8/8 3,180 MiB 0,004 s OK

Ocenjevani program (akcija.cpp):
#include <cstdio>
#include <iostream>
#include <cstdint>

using namespace std;
typedef int64_t i64;

int main()
{
	int st_dni_v_mesecu[12] {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};


	int N;
	int sr = scanf ("%d", &N);
//  cout << "N: " << N << endl;

	int64_t stock = 0;
	int64_t hi_freq, lo_freq, freq;
	int64_t dan, leto;
	char * mesec = new char[10];
	int st_meseca;

	for (int izdelek = 0; izdelek < N; ++izdelek) {
		sr = scanf ("%ld %ld.%ld %ld. %s %ld", &stock, &hi_freq, &lo_freq, &dan, mesec, &leto);
		if (sr != 6)
			throw runtime_error ("BLah");

		freq = 100*hi_freq + lo_freq;
//		cout << "Stock: " << stock << " freq: " << freq << " dan: " << dan << " mesec: " << mesec;	

		switch (mesec[0]) {
		case 'a': 
			if ('p' == mesec[1]) // april
				st_meseca = 4;
			else
				st_meseca = 8;
			break;
		case 'f': st_meseca = 2; break; //februar
		case 'm':
			if ('r' == mesec[2])
				st_meseca = 3; // marec
			else
				st_meseca = 5; // maj
			break;
		case 'j':
			if ('a' == mesec[1])
				st_meseca = 1; // januar
			else if ('n' == mesec[2]) // junij
				st_meseca = 6;
			else
				st_meseca = 7; // julij
 			break;
		case 's': st_meseca = 9; break; // september
		case 'o': st_meseca = 10; break; // oktober
		case 'n': st_meseca = 11; break; // november
		case 'd': st_meseca = 12; break; // december
		}
		st_meseca -= 1; // 0-indexed

		// Razdalja v dnevih
		int st_dni = 0;
		if (st_meseca < 3) {
			puts ("V SMETI");
			continue;
		} else if (3 == st_meseca) {
			st_dni = dan - 20 + 1;
		} else {
			st_dni = 11; //st_dni_v_mesecu[3] - 20 + 1; // preostanek v mesecu // 11 za april
			for (int i = 4; i < st_meseca; ++i)
				st_dni += st_dni_v_mesecu[i];
			st_dni += dan;
		}
//		cout << " mesec: " << st_meseca << " st dni: " << st_dni << endl;

		if (st_dni <= 0)
			puts ("V SMETI");
		else if ((freq * st_dni) >= (stock*100))
			puts ("OK");
		else
			puts ("AKCIJA");
	}


}