QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#103303 | #6138. Function and Function | evirir# | WA | 23ms | 3360kb | C++20 | 799b | 2023-05-05 05:56:23 | 2023-05-05 05:56:24 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define forn(i,a,b) for(int i = a; i < (b); i++)
#define fore(i,a,b) for(int i = a; i <= (b); i++)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
using ll = long long;
using ld = long double;
using ii = pair<int, int>;
const int a[] = {1, 0, 0, 0, 1, 0, 1, 0, 2, 1};
ll f(ll x)
{
ll sum=0;
while(x)
{
sum += a[x % 10];
x /= 10;
}
return sum;
}
void solve()
{
ll x,K; cin>>x>>K;
while(K--)
{
x = f(x);
if (x <= 1)
{
cout << (x ^ (K % 2)) << '\n';
return;
}
}
cout << x << '\n';
}
int main()
{
cin.tie(0)->sync_with_stdio(0);
int t; cin>>t;
forn(i,0,t) solve();
}
詳細信息
Test #1:
score: 100
Accepted
time: 2ms
memory: 3360kb
input:
6 123456789 1 888888888 1 888888888 2 888888888 999999999 98640 12345 1000000000 0
output:
5 18 2 0 0 1000000000
result:
ok 6 numbers
Test #2:
score: -100
Wrong Answer
time: 23ms
memory: 3356kb
input:
100000 579268184 2 120252252 777743676 255650198 1 152055433 207664522 137430584 754115403 646417467 164848484 743551976 0 0 408695577 363072674 569574204 464290891 0 761830281 3 0 1 49176280 2 791182580 0 474930784 3 402374924 0 739903247 91553857 0 2 688106229 2 65907033 152261569 875191599 3 5319...
output:
0 0 5 0 1 1 743551976 0 1 464290891 0 0 1 791182580 1 402374924 0 1 2 0 1 1 2 1 0 0 0 3 1 0 0 1 0 0 1 0 2 0 1 1 1 0 1 0 0 0 0 0 0 0 55349255 486354015 1 0 0 1 1 0 1 1 0 1 0 9 1 1 1 0 0 1 0 0 1 1 0 0 0 0 25600152 0 0 1 22903397 705086250 771453912 1 1 0 0 1 0 1 0 1 2 0 0 1 1 1 1 6 3 3 1 0 1 0 0 86248...
result:
wrong answer 8th numbers differ - expected: '1', found: '0'