QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#374561#8316. Random PermutationPetroTarnavskyi#WA 1ms3788kbC++201.2kb2024-04-02 15:11:012024-04-02 15:11:01

Judging History

你现在查看的是最新测评结果

  • [2024-04-02 15:11:01]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3788kb
  • [2024-04-02 15:11:01]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (a) - 1; i >= (b); i--)
#define SZ(a) int(a.size())
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair
#define F first
#define S second 

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef double db;

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	map<string, db> m;
	m["ATK"] = 0;
	m["ATK Rate"] = 0;
	m["Crit Rate"] = 0.05;
	m["Crit DMG Rate"] = 0.5;
	
	FOR (i, 0, 25)
	{
		string s;
		getline(cin, s);
		FOR (j, 0, SZ(s))
		{
			if (s[j] == '+')
			{
				string stat = s.substr(0, j);
				string val = s.substr(j + 1, SZ(s) - j - 1);
				bool per = false;
				if (val.back() == '%')
				{
					val.pop_back();
					per = true;
				}
				db d = stod(val);
				if (per)
					d /= 100;
				m[stat] += d;
			}
		}
	}
	
	db atk = 1500 * (1 + m["ATK Rate"]) + m["ATK"];
	db cr = min(1.0, m["Crit Rate"]);
	db crd = m["Crit DMG Rate"];

	db E = atk * (1 - cr) + atk * (1 + crd) * cr;
	cout << fixed << setprecision(15) << E << '\n'; 
	
	return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3788kb

input:

2

output:

1537.499999999999773

result:

wrong answer 1st numbers differ - expected: '1.0000000', found: '1537.5000000', error = '1536.5000000'