QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#708774#2944. Transporting Spaghettisefnuray#WA 0ms3828kbC++14850b2024-11-04 06:17:542024-11-04 06:17:55

Judging History

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

  • [2024-11-04 06:17:55]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3828kb
  • [2024-11-04 06:17:54]
  • 提交

answer

#include <iostream>
#include <algorithm>
#include <bitset>
#include <vector>
#include <cmath>
#include <string>
#include <set>
#include <map>
#include <unordered_map>
#include <sstream>
#include <iomanip>
#include <stdexcept>
#include <utility>
#include <deque>
using namespace std;
typedef long long ll;
typedef long double ld;

int gcd (int a, int b) {
    return b ? gcd (b, a % b) : a;
}

int main() {
    //these first two lines speed up input / output significantly
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    ld a, b, c, d;

    cin>>a;
    cin>>b;
    cin>>c;
    cin>>d;


    if(a>(b+d)) {
        cout<<"No solution.";
    } else {
        
    ll t = ceil((c+d)/a);
    ll boats = ceil((a*t-d)/b);

    cout<<"We need "<<t<<" trucks and "<<boats<<" boats."   ; 

    }


}
    

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3772kb

input:

31 13 50 28

output:

We need 3 trucks and 5 boats.

result:

ok single line: 'We need 3 trucks and 5 boats.'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3828kb

input:

100 20 30 10

output:

No solution.

result:

ok single line: 'No solution.'

Test #3:

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

input:

1 1 1 100

output:

We need 101 trucks and 1 boats.

result:

wrong answer 1st lines differ - expected: 'We need 101 trucks and 1 boat.', found: 'We need 101 trucks and 1 boats.'