Submission #88948

# Submission time Handle Problem Language Result Execution time Memory
88948 2018-12-10T06:52:40 Z beso123 Experiments with Gorlum (IZhO13_expgorl) C++14
0 / 100
2 ms 504 KB
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
using namespace std;
double n;
double a1,b1,a2,b2;
double dis1;
void dis(){
double a=(a1-a2)*(a1-a2);
double b=(b1-b2)*(b1-b1);
dis1=sqrt(a+b);
}
int main(){
    freopen("expgorl.in","r",stdin);
    freopen("expgorl.out","w",stdout);
   //cout<<setprecision(2)<<3;
cin>>n;
string s;
cin>>s;
cin>>a1>>b1>>a2>>b2;
double mn=INT_MAX,mx=-INT_MAX;
for(int k=0;k<s.size();k++){
   if(s[k]=='L')
    a1--;
   if(s[k]=='R')
    a1++;
   if(s[k]=='F')
    b1++;
   if(s[k]=='B')
    b1--;
    dis();
    if(mx<dis1)
        mx=dis1;
    if(mn>dis1)
        mn=dis1;
}
cout<<fixed;
cout<<setprecision(12)<<mn<<' ';

cout<<setprecision(12)<<mx;
//cout<<fixed;
    return 0;
}

Compilation message

expgorl.cpp: In function 'int main()':
expgorl.cpp:22:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 for(int k=0;k<s.size();k++){
             ~^~~~~~~~~
expgorl.cpp:29:4: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
    if(s[k]=='B')
    ^~
expgorl.cpp:31:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
     dis();
     ^~~
expgorl.cpp:14:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
     freopen("expgorl.in","r",stdin);
     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
expgorl.cpp:15:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
     freopen("expgorl.out","w",stdout);
     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 504 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -