QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#304190#7897. Largest Digitalgotester#WA 0ms3608kbC++201.7kb2024-01-13 16:20:352024-01-13 16:20:36

Judging History

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

  • [2024-01-13 16:20:36]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3608kb
  • [2024-01-13 16:20:35]
  • 提交

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 l, r, ll, rr;

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


  if (r-l > 20 || r-l > 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: 0
Wrong Answer
time: 0ms
memory: 3608kb

input:

2
178 182 83 85
2 5 3 6

output:

9

result:

wrong answer 1st lines differ - expected: '7', found: '9'