Skip to content

Instantly share code, notes, and snippets.

@Shirataki2
Last active Nov 24, 2017
Embed
What would you like to do?
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i=0;i<n;i++)
static const int inf = 1<<30;
void Degree(int deg){
int idx=((deg*10 + 1125)%36000)/2250;
switch(idx){
case 0: cout << "N" ; break;
case 1: cout << "NNE" ; break;
case 2: cout << "NE" ; break;
case 3: cout << "ENE" ; break;
case 4: cout << "E" ; break;
case 5: cout << "ESE" ; break;
case 6: cout << "SE" ; break;
case 7: cout << "SSE" ; break;
case 8: cout << "S" ; break;
case 9: cout << "SSW" ; break;
case 10: cout << "SW" ; break;
case 11: cout << "WSW" ; break;
case 12: cout << "W" ; break;
case 13: cout << "WNW" ; break;
case 14: cout << "NW" ; break;
case 15: cout << "NNW" ; break;
}
}
int WindPow(int dis){
if(dis < 15) return 0;
if(dis < 93) return 1;
if(dis < 201) return 2;
if(dis < 327) return 3;
if(dis < 477) return 4;
if(dis < 645) return 5;
if(dis < 831) return 6;
if(dis < 1029) return 7;
if(dis < 1245) return 8;
if(dis < 1467) return 9;
if(dis < 1707) return 10;
if(dis < 1959) return 11;
return 12;
}
int main(void){
int deg, dis;
cin >> deg >> dis;
int p=WindPow(dis);
if(p==0) cout << "C";
else Degree(deg);
cout << " " << p << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment