Submission #15269

# Submission time Handle Problem Language Result Execution time Memory
15269 2015-07-12T05:09:41 Z seirion 맛있는 과자 (kriii3_A) C++
Compilation error
0 ms 0 KB
#include <iostream>
#include <cstdio>
#include <cmath>
#include <deque>
#include <algorithm>

using namespace std;

deque<double> q;

int a, b, n, k;
double dev;

void cut() {
    deque<double> temp;
    for (auto d : q) {
        temp.push_back(d*a*a/dev/dev);
        temp.push_back(d*b*b/dev/dev);
    }
    q.swap(temp);
}

int main() {
    cin >> a >> b >> n >> k;
    dev = sqrt(a*a + b*b);
    q.push_back((double)a*b/2);
    while (n--) {
        cut();
    }
    sort(q.begin(), q.end());
    auto r = q.begin();
    advance(r, k);
    printf("%0.10f\n", log(*r));
    return 0;
}

Compilation message

A.cpp: In function ‘void cut()’:
A.cpp:16:10: warning: ‘auto’ changes meaning in C++11; please remove it [-Wc++0x-compat]
     for (auto d : q) {
          ^
A.cpp:16:15: error: ‘d’ does not name a type
     for (auto d : q) {
               ^
A.cpp:20:5: error: expected ‘;’ before ‘q’
     q.swap(temp);
     ^
A.cpp:20:16: error: could not convert ‘q.std::deque<_Tp, _Alloc>::swap<double, std::allocator<double> >((* & temp))’ from ‘void’ to ‘bool’
     q.swap(temp);
                ^
A.cpp:21:1: error: expected primary-expression before ‘}’ token
 }
 ^
A.cpp:21:1: error: expected ‘)’ before ‘}’ token
A.cpp:21:1: error: expected primary-expression before ‘}’ token
A.cpp: In function ‘int main()’:
A.cpp:31:5: warning: ‘auto’ changes meaning in C++11; please remove it [-Wc++0x-compat]
     auto r = q.begin();
     ^
A.cpp:31:10: error: ‘r’ does not name a type
     auto r = q.begin();
          ^
A.cpp:32:13: error: ‘r’ was not declared in this scope
     advance(r, k);
             ^