QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#499520#6731. Digit Product122WA 0ms3640kbC++14813b2024-07-31 15:13:522024-07-31 15:13:54

Judging History

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

  • [2024-07-31 15:13:54]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3640kb
  • [2024-07-31 15:13:52]
  • 提交

answer

#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(false);cin.tie(0); 
using namespace std;

const int mod = 1e9 + 7;
int f(int a)
{
    int sum = 1;
    while (a / 10)
    {
        int tem = a % 10;
        sum *= tem;
        a /= 10;

    }
    int tem = a % 10;
    sum *= tem;
    a /= 10;
    return sum;
}
signed main() {
    IOS;
    int t;
    cin >> t;
    while (t--)
    {
        int l, r;
        cin >> l >> r;
        int ans = 1;
        bool flag=false;
        if(r-l>=10)
        {flag=true;
                cout<<0<<endl;
                break;
            }
        for (int i = l; i <= r; i++)
        {
        
            ans *= f(i);
            ans %= mod;
        }
        if(!flag)cout << ans << endl;
    }
    
    
    
}


详细

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: 0ms
memory: 3636kb

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
174246393
0
0
1512000
-245012473
343669753
0

result:

wrong answer 2nd numbers differ - expected: '410944971', found: '174246393'