Rezultati

Up. imeNalogaJezikRezultatČas oddaje
zgancejem-2019 Revolver C++ 0/100Napačen odgovor (WA) 09. maj '19 @ 19:24

Test Točke Porabljen spomin Porabljen čas Status
#1 [več] 0/14 3,254 MiB 0,000 s Napačen odgovor
#2 [več] 0/14 3,258 MiB 0,000 s Napačen odgovor
#3 [več] 0/14 3,152 MiB 0,012 s Napačen odgovor
#4 [več] 0/14 3,258 MiB 0,001 s Napačen odgovor
#5 [več] 0/14 3,258 MiB 0,001 s Napačen odgovor
#6 [več] 0/15 3,164 MiB 0,020 s Napačen odgovor
#7 [več] 0/15 3,254 MiB 0,020 s Napačen odgovor

Ocenjevani program (Malica.cpp):
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <math.h>
#include <map>
#include <set>
#include <unordered_set>
#include <stack>
#include <list>
#include <bitset>
#include <utility>
#include <algorithm>
#include <iomanip>

using namespace std;

#define all(x) (x).begin(), (x).end()
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define forn(i,n) for(int i=0;i<(int)n;++i)
#define ford(i,n) for(int i=(int)n-1;i>=0;--i)

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<vii> vvii;

const ll mod = 1000000007;
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }

int main()
{
	int T;
	cin >> T;
	while (T--) {
		long double ret, safeChance, rollChance;
		int k = 0, n, p, safe = 0, unsafe = 0, all, numSafe;
		cin >> n >> p;
		string str;
		cin >> str;
		all = n;
		for (int i = 0; i < all; i++)
		{
			int j = (i + 1) % all;
			if (str[i] == '.' && str[j] == '.') {
				safe++;
			}
			else if (str[i] == '.' && str[j] == '*') {
				unsafe++;
			}

			if (str[i] == '*') {
				k++;
			}
		}
		rollChance = ((long double)all -k) / all;
		ret = rollChance;
		numSafe = 0;
		vector<string> outs;
		p--;
		while (p--) {
			safeChance = ((long double)(safe - numSafe)) / ((long double)safe + unsafe - numSafe);
			if (safeChance >= rollChance) {
				outs.emplace_back("FIRE\n");
				numSafe++;
				ret *= safeChance;
			}
			else {
				numSafe = 0;
				outs.emplace_back("ROLL\n");
				ret *= rollChance;
			}
		}

		cout << setprecision(15) << ret << "\n";
		for (auto a : outs) {
			cout << a;
		}
	}

	//cin >> T;//sdsd
	return 0;
}