QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#499389 | #6731. Digit Product | 1DemonS1 | WA | 22ms | 3640kb | C++20 | 867b | 2024-07-31 13:41:59 | 2024-07-31 13:41:59 |
Judging History
answer
#include<bits/stdc++.h>
//#define int long long
#define endl "\n"
#define ll long long
#define PII std::pair<int,int>
using namespace std;
const int maxn = 1e5 + 5;
const int mod = 1e9 + 7;
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(0);
int T; cin >> T;
while (T--) {
int l, r; cin >> l >> r;
bool flag = false;
int ans = 1;
for (int i = l; i <= r; ++i) {
int num = i;
while (num) {
int temp = num % 10;
if (temp == 0) {
flag = true;
break;
}
ans = ans * temp % mod;
num /= 10;
}
if (flag) break;
}
if (flag) cout << "0" << endl;
else cout << ans << endl;
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3640kb
input:
2 1 9 97 99
output:
362880 367416
result:
ok 2 number(s): "362880 367416"
Test #2:
score: -100
Wrong Answer
time: 22ms
memory: 3564kb
input:
100000 657483518 657483518 296765674 296765675 500554849 500554849 392403 392411 962255578 962255578 35428433 35428436 362396272 362396273 284893570 974440644 115568436 806300808 751214641 751214647 646086592 646086598 437591523 437591526 263956058 263956059 558669721 558669723 655489691 655489692 2...
output:
806400 885825945 0 0 1512000 999744033 998375151 0 0 480147641 0 -4868250 0 -22436857 212712569 -999205384 771559256 0 0 0 0 -651367744 4320 11337408 653184 34118416 0 71039990 -357556994 4608 0 26880 0 0 -748574808 311040 0 142056617 0 -744414948 489888 51840 0 841821146 0 933120 0 0 0 -651024573 4...
result:
wrong answer 2nd numbers differ - expected: '410944971', found: '885825945'