QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#131854 | #5130. Failing Flagship | Yarema# | WA | 1ms | 3732kb | C++17 | 1023b | 2023-07-28 16:09:21 | 2023-07-28 16:09:22 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define FOR(i, a, b) for (int i = (a); i<(b); ++i)
#define RFOR(i, b, a) for (int i = (b)-1; i>=(a); --i)
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define FILL(a, b) memset(a, b, sizeof(a))
typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
const int INF = 1e9 + 7;
map<char, int> m;
double ang(string s)
{
double res = m[s[0]];
FOR (i, 1, SZ(s))
{
double x = m[s[i]];
if (s[i] == 'N' && res > 180) x = 360;
res = (res + x) / 2;
}
return res;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
m['N'] = 0;
m['E'] = 90;
m['S'] = 180;
m['W'] = 270;
string s, t;
cin >> s >> t;
reverse(ALL(s));
reverse(ALL(t));
double ans = ang(t) - ang(s);
if (ans < 0) ans += 360;
if (ans > 180) ans = 360 - ans;
cout << fixed << setprecision(7) << ans << '\n';
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3596kb
input:
N S
output:
180.0000000
result:
ok found '180.0000000', expected '180.0000000', error '0.0000000'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3728kb
input:
NNE SSSE
output:
146.2500000
result:
ok found '146.2500000', expected '146.2500000', error '0.0000000'
Test #3:
score: 0
Accepted
time: 1ms
memory: 3732kb
input:
ENE NW
output:
112.5000000
result:
ok found '112.5000000', expected '112.5000000', error '0.0000000'
Test #4:
score: 0
Accepted
time: 1ms
memory: 3692kb
input:
SW SE
output:
90.0000000
result:
ok found '90.0000000', expected '90.0000000', error '0.0000000'
Test #5:
score: -100
Wrong Answer
time: 1ms
memory: 3660kb
input:
NENE SESSE
output:
118.1250000
result:
wrong answer 1st numbers differ - expected: '95.6250000', found: '118.1250000', error = '0.2352941'