Submission #409731


Source Code Expand

#include<iostream>
#include<string>
#include<vector>
#include<cmath>
using namespace std;

int  main(){
  int deg,dis;
  string ansdeg="";
  cin>>deg>>dis;


  vector<string> s{"N","NNE","NE","ENE","E","ESE","SE","SSE","S","SSW","SW","WSW","W","WNW","NW","NNW"};

  int tmp=113;
  for(int i=0;i<s.size();i++){
    if(deg<tmp){
      ansdeg=s[i];
      break;
    }
    tmp+=225;
  }
  if(ansdeg=="")ansdeg="N";

  double diss=(double)dis/6;
  diss=(double)round(diss)/10;

  vector<double> d{0.3,1.6,3.4,5.5,8.0,10.8,13.9,17.2,20.8,24.5,28.5,32.7};
  int disans=-1;

  for(int i=0;i<d.size();i++){
    if(diss<d[i]){
      disans=i;
      break;
    }
  }
  if(disans<0)disans=12;
  if(disans==0)ansdeg="C";

  cout<<ansdeg<<" "<<disans<<endl;
  return 0;
}

Submission Info

Submission Time
Task C - 風力観測
User cormoran
Language C++ (G++ 4.6.4)
Score 0
Code Size 800 Byte
Status CE

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:13:18: warning: extended initializer lists only available with -std=c++0x or -std=gnu++0x [enabled by default]
./Main.cpp:13:103: error: in C++98 ‘s’ must be initialized by constructor, not by ‘{...}’
./Main.cpp:13:103: error: no matching function for call to ‘std::vector<std::basic_string<char> >::vector(<brace-enclosed initializer list>)’
./Main.cpp:13:103: note: candidates are:
/usr/include/c++/4.6/bits/stl_vector.h:334:9: note: template<class _InputIterator> std::vector::vector(_InputIterator, _InputIterator, const allocator_type&)
/usr/include/c++/4.6/bits/stl_vector.h:278:7: note: std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&) [with _Tp = std::basic_string<char>, _Alloc = std::allocator<std::basic_string<char> >, std::vector<_Tp, _Alloc> = std::vector<std::basic_string<char> >]
/usr/include/c++/4.6/bits/stl_vector.h:278:7: note:   candidate expects 1 argument, 16 provided
/usr/include/c++/4.6/bits/stl_vector.h:263:7: not...