#include <iostream> #include <algorithm> #include <vector> using namespace std; int main(int argc, char *argv[]){ int n; while(cin>>n){ int total=n; int empty=n; int remain; while (empty>=3){ remain = empty/3; empty = empty%3; total += remain; empty += remain; } if (empty==2){ total++; } cout << total << endl; } return 0; }
沒有留言:
張貼留言