#include using namespace std; //15の余剰やーん int main(void) { long long int n,ans;//ansもlonglongか int p, k = 0; cin >> n; p = n % 15; switch (p){ case 1: case 2: break; case 3: case 4: k = 2; break; case 5: k = 4; break; case 6: case 7: case 8: k = 6; break; case 9: k = 8; break; case 10: case 11: k = 10; break; case 12: case 13: case 14: k = 12; break; default://caseでなくともn/3+n/5の2倍の値をintで表せばいいのか break; } ans = 16 * (int)(n / 15) + k; cout << ans; return 0; }