当前位置: 代码迷 >> 综合 >> Canada Cup 2016 B. Food on the Plane 找规律 .
  详细解决方案

Canada Cup 2016 B. Food on the Plane 找规律 .

热度:122   发布时间:2023-09-23 05:14:38.0
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,b) for(int i=a;i<=(b);++i)
#define REPD(i,a,b) for(int i=a;i>=(b);--i)
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
typedef long long LL;
int main(int argc, char const *argv[])
{LL a;char ch;const char p[]=" fedabc";scanf("%I64d%c",&a,&ch); a--; LL n=a/4*2+(a&1); LL m=n/2*4+(n&1);printf("%I64d\n", n*6+m+(find(p,p+7,ch)-p));return 0;
}