Rezultati

Up. imeNalogaJezikRezultatČas oddaje
undefined-2017 Akcija C++ 100/100OK 20. apr '17 @ 19:43

Test Točke Porabljen spomin Porabljen čas Status
#1 7/7 3,191 MiB 0,004 s OK
#2 7/7 3,203 MiB 0,004 s OK
#3 7/7 3,188 MiB 0,010 s OK
#4 7/7 3,191 MiB 0,037 s OK
#5 8/8 3,199 MiB 0,359 s OK
#6 8/8 3,184 MiB 0,347 s OK
#7 8/8 3,191 MiB 0,347 s OK
#8 8/8 3,191 MiB 0,371 s OK
#9 8/8 3,188 MiB 0,346 s OK
#10 8/8 3,188 MiB 0,341 s OK
#11 8/8 3,188 MiB 0,341 s OK
#12 8/8 3,199 MiB 0,346 s OK
#13 8/8 3,191 MiB 0,004 s OK

Ocenjevani program (Source.cpp):
#include <iostream>
#include <string>
#include <unordered_map>
#include <stack>
#include <vector>
#include <chrono>
#include <algorithm>
#include <sstream>
#include <vector>
#include <iterator>

template<typename Out>
void split(const std::string &s, char delim, Out result) {
	std::stringstream ss;
	ss.str(s);
	std::string item;
	while (std::getline(ss, item, delim)) {
		*(result++) = item;
	}
}


std::vector<std::string> split(const std::string &s, std::vector<std::string>&elems, char delim) {
	split(s, delim, std::back_inserter(elems));
	return elems;
}



int main() {
	//freopen("C:\\Users\\matej.drobnic\\Desktop\\datumtest.txt", "r", stdin);
	auto start = std::chrono::system_clock::now();

	std::string line;
	int n;

	std::getline(std::cin, line);
	n = stoi(line);

	std::vector<std::string> splitVec;

	std::unordered_map<std::string, int> months;
	months.insert(std::make_pair("januar",    0));
	months.insert(std::make_pair("februar",   31));
	months.insert(std::make_pair("marec",     31 + 28));
	months.insert(std::make_pair("april",     31 + 28 + 31));
	months.insert(std::make_pair("maj",       31 + 28 + 31 + 30));
	months.insert(std::make_pair("junij",     31 + 28 + 31 + 30 + 31));
	months.insert(std::make_pair("julij",     31 + 28 + 31 + 30 + 31 + 30));
	months.insert(std::make_pair("avgust",    31 + 28 + 31 + 30 + 31 + 30 + 31));
	months.insert(std::make_pair("september", 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31));
	months.insert(std::make_pair("oktober",   31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30));
	months.insert(std::make_pair("november",  31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31));
	months.insert(std::make_pair("december",  31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30));

	int today = months["april"] + 20;

	for (int i = 0; i < n; i++) {
		std::getline(std::cin, line);
		splitVec.clear();
		split(line, splitVec, ' ');

		unsigned long long stock = stol(splitVec[0]) * 100;

		std::string& avgString = splitVec[1];
		avgString.erase(std::find(avgString.begin(), avgString.end(), '.'));

		unsigned long long average = stol(avgString);
		std::string& dayString = splitVec[2];
		dayString = dayString.substr(0, dayString.size() - 1);
		unsigned long long day = stoi(dayString);

		unsigned long long month = months.at(splitVec[3]);

		unsigned long long expireDate = month + day;
		signed long long daysPassed = expireDate - today;

		if (daysPassed < 0) {
			std::cout << "V SMETI" << std::endl;
		}
		else if ((daysPassed + 1) * average < stock)
		{
		std::cout << "AKCIJA" << std::endl;
		}
		else
		{
			std::cout << "OK" << std::endl;
		}


		/*int stock = Integer.parseInt(splited[0]);
		float average = Float.parseFloat(splited[1]);
		String dayString = splited[2];
		dayString = dayString.substring(0, dayString.length() - 1);
		int day = Integer.parseInt(dayString);
		String month = splited[3];

		int productDay = months.get(month) + day;

		int days = productDay - today;

		if (days < 0)
			System.out.println("V SMETI");
		else if ((days + 1)*average < stock)
			System.out.println("AKCIJA");
		else
			System.out.println("OK");*/
	}

	auto end = std::chrono::system_clock::now();
	//std::cout << std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count() << std::endl;
	return 0;
}