답안 #1115150

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1115150 2024-11-20T07:13:09 Z erering 질문 (CEOI14_question_grader) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define pb push_back
const int MOD=819276405795233,MAXN=1e6+5,inf=1e9+5;
void A() {
    srand(4382932498);
    setprecision(13);
    int n,t,cnt=0; cin >> n >> t;
    vector<int> v(t);
    for(int i=0;i<t;i++)v[i]=rand()%MOD;
    while (t--) {
        long double x,y; cin >> x >> y;
        for(int i=1;i<=20;i++){
            long double f=x/(i*v[cnt]),s=y/(i*v[cnt]);
            int r=0,e=0;
            for(int j=13;j>=-3;j--){
                if(r==0)r=(int)(f*pow(10,j))%10;
                if(e==0)e=(int)(s*pow(10,j))%10;
                if(r>0 && e>0)break;
            }
            if(r%2==0 && e%2==1){
                cout<<i<<endl;
                break;
            }
        }
        // stuff...
        cnt++;
    }
}

void B() {
    srand(4382932498);
    setprecision(13);
    int n,t,cnt=0; cin >> n >> t;
    vector<int> v(t);
    for(int i=0;i<t;i++)v[i]=rand()%MOD;
    while (t--) {
        long double q,h; cin >> q >> h;
        long double f=q/(h*v[cnt]);
        int r=0;
        for(int j=13;j>=-3;j--){
            if(r==0)r=(int)(f*pow(10,j))%10;
            if(r>0)break;
        }
        cout<<(r%2==0?"yes":"no")<<endl;
        cnt++;
        // stuff...
    }
}

signed main()
{
    /*
     * 1
5 6
1 2
4 5
1 2
3 5
4 5
5 2
     */
    /*
      2
      5 6
      1 8
      4 2
      2 1
      3 2
      5 3
      2 4
     *
     */
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    //srand(time(NULL));
    int TYPE; cin >> TYPE;
    TYPE == 1 ? A() : B();

}



    

Compilation message

encoder.cpp: In function 'void A()':
encoder.cpp:8:11: warning: unsigned conversion from 'long int' to 'unsigned int' changes value from '4382932498' to '87965202' [-Woverflow]
    8 |     srand(4382932498);
      |           ^~~~~~~~~~
encoder.cpp: In function 'void B()':
encoder.cpp:34:11: warning: unsigned conversion from 'long int' to 'unsigned int' changes value from '4382932498' to '87965202' [-Woverflow]
   34 |     srand(4382932498);
      |           ^~~~~~~~~~
/usr/bin/ld: /tmp/ccdkgkHR.o: in function `main':
grader_encode.c:(.text.startup+0x0): multiple definition of `main'; /tmp/ccp4MIgP.o:encoder.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccdkgkHR.o: in function `main':
grader_encode.c:(.text.startup+0x129): undefined reference to `encode(int, int, int)'
collect2: error: ld returned 1 exit status

/usr/bin/ld: /tmp/ccmZZ2Cz.o: in function `main':
grader_decode.c:(.text.startup+0x22f): undefined reference to `decode(int, int, int)'
collect2: error: ld returned 1 exit status