Submission #637246
Source Code Expand
#include <iostream> #include <string> #include <vector> #include <algorithm> #include <cmath> #include <cstdio> #include <functional> #include <numeric> #include <stack> #include <map> using namespace std; #define FOR(i,a,b) for(long long int i=(a);i<(b);i++) #define REP(i,n) for(long long int i=0;i<(n);i++) #define ALL(s) (s).begin(),(s).end() #define PI 3.14159265358479 typedef long long ll; int c = -1; double e, g; char vs[17][5] = { "N", "NNE", "NE", "ENE", "E", "ESE", "SE", "SSE", "S", "SSW", "SW", "WSW", "W", "WNW", "NW", "NNW", "N" }; vector<double> vd{ 0.0, 0.25 * 60, 1.55 * 60, 3.35 * 60, 5.45 * 60, 7.95 * 60, 10.75 * 60, 13.85 * 60, 17.15 * 60, 20.75 * 60, 24.45 * 60, 28.45 * 60, 32.65 * 60 }; string s; int w; int main(){ cin >> e >> g; e /= 10; cout << g << endl; double a = 11.2; for (int i = 0;; i++){ if (g <= 0.2 * 60){ cout << "c "; break; } if (a > e){ cout << "N "; break; } if (a < e&&a + 22.5 >= e){ cout << vs[i + 1] << " "; break; } a += 22.5; } for (int i = 0; i < 13; i++){ if (vd[i] <= g){ c++; } } cout << c << endl; }
Submission Info
Submission Time | |
---|---|
Task | C - 風力観測 |
User | jimmy |
Language | C++ (G++ 4.6.4) |
Score | 0 |
Code Size | 1167 Byte |
Status | CE |
Compile Error
./Main.cpp:25:16: warning: extended initializer lists only available with -std=c++0x or -std=gnu++0x [enabled by default] ./Main.cpp:26:84: error: in C++98 ‘vd’ must be initialized by constructor, not by ‘{...}’ ./Main.cpp:26:84: error: no matching function for call to ‘std::vector<double>::vector(<brace-enclosed initializer list>)’ ./Main.cpp:26:84: 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 = double, _Alloc = std::allocator<double>, std::vector<_Tp, _Alloc> = std::vector<double>] /usr/include/c++/4.6/bits/stl_vector.h:278:7: note: candidate expects 1 argument, 13 provided /usr/include/c++/4.6/bits/stl_vector.h:263:7: note: std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>::size_type, const value_type&, const allocator_type&) ...