QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#304196#7897. Largest Digitalgotester#WA 1ms3424kbC++201.7kb2024-01-13 16:22:302024-01-13 16:22:30

Judging History

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

  • [2024-01-13 16:22:30]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3424kb
  • [2024-01-13 16:22:30]
  • 提交

answer

#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/stack:16777216")
#include <string>
#include <vector>
#include <map>
#include <list>
#include <iterator>
#include <set>
#include <queue>
#include <iostream>
#include <sstream>
#include <stack>
#include <deque>
#include <cmath>  
#include <memory.h>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <algorithm>
#include <utility>
#include <time.h>
#include <bitset>
#include <random>
using namespace std;

#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 ITER(it, a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(A,value) memset(A,value,sizeof(A))

#define ALL(V) V.begin(), V.end()
#define SZ(V) (int)V.size()
#define PB push_back
#define MP make_pair
const double PI=acos(-1.0);

typedef long long Int;
typedef long long LL;
typedef unsigned long long UINT;
typedef vector <int> VI;
typedef pair <int, int> PII;
typedef pair <double, double> PDD;

const int INF = 1000 * 1000 * 1000 + 7;
const LL LINF = INF * (LL) INF;

const int MAX = 100007;
const int MAXK = 51;
const int MAX2 = 24000000;
const int LEN = 21;
const int BASE = 1000000000;

int f(int x)
{
  int res = 0;
  while (x > 0)
  {
    res = max(res, x % 10);
    x /= 10;
  }

return res;
}

int main()
{
  int t;

  cin >> t;

  FOR (tt,0,t)
  {
    int l, r, ll, rr;

    cin >> l >> r >> ll >> rr;


    if (r-l > 20 || rr-ll > 20)
    {
      cout << 9 << endl;
      return 0;
    }

    int res = 0;

    FOR (a,l,r+1)
      FOR (b,ll,rr+1)
      {
        res = max(res, f(a+b));
      }  

    cout << res << endl;
  }
  
  
  return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3380kb

input:

2
178 182 83 85
2 5 3 6

output:

7
9

result:

ok 2 lines

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3424kb

input:

1000
158260522 877914575 24979445 602436426
1 5 1101111 1101112
2 5 33333 33335
1 5 10111 10111
138996221 797829355 353195922 501899080
212 215 10302 10302
101100 101101 1 2
111 114 1101000 1101001
265804420 569328197 234828607 807497925
1110110 1110112 11100 11103
323 327 23 27
1 1 1 5
316412581 80...

output:

9

result:

wrong answer 2nd lines differ - expected: '7', found: ''