QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#311435#3288. Rendezvous on a TetrahedronNYCU_CartesianTree#Compile Error//C++142.1kb2024-01-22 13:07:222024-01-22 13:07:22

Judging History

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

  • [2024-01-22 13:07:22]
  • 评测
  • [2024-01-22 13:07:22]
  • 提交

answer

//#include<bits/stdc++.h>
using namespace std;
const double pi = acos(-1), sqrt3 = sqrt(3);

int getSide30(string e, double d, double l){
    double x = sqrt3 / 2;
    while(l >= x + x + 1){
        l -= (x + x + 1);
    }
    int side;
    if(l < x)
        side = 1;
    else
        side = 4;
    if(side == 1){
        if(e == "BC"){
            side = 1;
        }else if(e == "CD"){
            side = 2;
        }else{
            side = 3;
        }
    }
    return side;
}
int getSide(string e, double d, double l){
    bool moreThan30 = d > 30;
    if(moreThan30){
        d = 60 - d;
    }
    d = pi * (d / 180);
    double x = sqrt3 / (sqrt3 * cos(d) + sin(d)), y = 2 * sqrt3 * sin(d) / (3 * cos(d) * cos(d) - sin(d) * sin(d)), z = x - y;
    cout << x << ' ' << y << ' ' << z << '\n';
    while(l > (x + y + z) * 2){
        l -= (x + y + z) * 2;
    }
    int side;
    if(l < x)
        side = 1;
    else if(l < x + y)
        side = 4;
    else if(l < x + y + z)
        side = 3;
    else if(l < x + y + z + z)
        side = 2;
    else if(l < x + y + y + z + z)
        side = 4;
    else
        side = 1;
    if(moreThan30 && (side == 2 || side == 3)){
        if(side == 2)
            side = 3;
        else
            side = 2;
    }
    if(e == "CD"){
        if(side == 1)
            side = 2;
        else if(side == 2)
            side = 3;
        else if(side == 3)
            side = 1;
    }else if(e == "DB"){
        if(side == 1)
            side = 3;
        else if(side == 2)
            side = 1;
        else if(side == 3)
            side = 2;
    }
    return side;
}
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    string pe, qe;
    double pd, pl, qd, ql;
    cin >> pe >> pd >> pl;
    cin >> qe >> qd >> ql;
    int side1, side2;
    if(pd == 30)
        side1 = getSide30(pe, pd, pl);
    else
        side1 = getSide(pe, pd, pl);
    if(qd == 30)
        side2 = getSide30(qe, qd, ql);
    else
        side2 = getSide(qe, qd, ql);
    if(side1 == side2){
        cout << "YES\n";
    }else{
        cout << "NO\n";
    }
}

详细

answer.code:3:19: error: ‘acos’ was not declared in this scope
    3 | const double pi = acos(-1), sqrt3 = sqrt(3);
      |                   ^~~~
answer.code:5:15: error: ‘string’ was not declared in this scope
    5 | int getSide30(string e, double d, double l){
      |               ^~~~~~
answer.code:1:1: note: ‘std::string’ is defined in header ‘<string>’; did you forget to ‘#include <string>’?
  +++ |+#include <string>
    1 | //#include<bits/stdc++.h>
answer.code:5:25: error: expected primary-expression before ‘double’
    5 | int getSide30(string e, double d, double l){
      |                         ^~~~~~
answer.code:5:35: error: expected primary-expression before ‘double’
    5 | int getSide30(string e, double d, double l){
      |                                   ^~~~~~
answer.code:5:43: error: expression list treated as compound expression in initializer [-fpermissive]
    5 | int getSide30(string e, double d, double l){
      |                                           ^
answer.code:26:13: error: ‘string’ was not declared in this scope
   26 | int getSide(string e, double d, double l){
      |             ^~~~~~
answer.code:26:13: note: ‘std::string’ is defined in header ‘<string>’; did you forget to ‘#include <string>’?
answer.code:26:23: error: expected primary-expression before ‘double’
   26 | int getSide(string e, double d, double l){
      |                       ^~~~~~
answer.code:26:33: error: expected primary-expression before ‘double’
   26 | int getSide(string e, double d, double l){
      |                                 ^~~~~~
answer.code:26:41: error: expression list treated as compound expression in initializer [-fpermissive]
   26 | int getSide(string e, double d, double l){
      |                                         ^
answer.code: In function ‘int main()’:
answer.code:74:5: error: ‘ios’ has not been declared
   74 |     ios::sync_with_stdio(0);
      |     ^~~
answer.code:75:5: error: ‘cin’ was not declared in this scope
   75 |     cin.tie(0);
      |     ^~~
answer.code:1:1: note: ‘std::cin’ is defined in header ‘<iostream>’; did you forget to ‘#include <iostream>’?
  +++ |+#include <iostream>
    1 | //#include<bits/stdc++.h>
answer.code:76:5: error: ‘string’ was not declared in this scope
   76 |     string pe, qe;
      |     ^~~~~~
answer.code:76:5: note: ‘std::string’ is defined in header ‘<string>’; did you forget to ‘#include <string>’?
answer.code:78:12: error: ‘pe’ was not declared in this scope; did you mean ‘pl’?
   78 |     cin >> pe >> pd >> pl;
      |            ^~
      |            pl
answer.code:79:12: error: ‘qe’ was not declared in this scope; did you mean ‘ql’?
   79 |     cin >> qe >> qd >> ql;
      |            ^~
      |            ql
answer.code:82:26: error: ‘getSide30’ cannot be used as a function
   82 |         side1 = getSide30(pe, pd, pl);
      |                 ~~~~~~~~~^~~~~~~~~~~~
answer.code:84:24: error: ‘getSide’ cannot be used as a function
   84 |         side1 = getSide(pe, pd, pl);
      |                 ~~~~~~~^~~~~~~~~~~~
answer.code:86:26: error: ‘getSide30’ cannot be used as a function
   86 |         side2 = getSide30(qe, qd, ql);
      |                 ~~~~~~~~~^~~~~~~~~~~~
answer.code:88:24: error: ‘getSide’ cannot be used as a function
   88 |         side2 = getSide(qe, qd, ql);
      |                 ~~~~~~~^~~~~~~~~~~~
answer.code:90:9: error: ‘cout’ was not declared in this scope
   90 |         cout << "YES\n";
      |         ^~~~
answer.code:90:9: note: ‘std::cout’ is defined in header ‘<iostream>’; did you forget to ‘#include <iostream>’?
answer.code:92:9: error: ‘cout’ was not declared in this scope
   92 |         cout << "NO\n";
      |         ^~~~
answer.code:92:9: note: ‘std::cout’ is defined in header ‘<iostream>’; did you forget to ‘#include <iostream>’?