用例 七层 一个 urn ios 表示 课堂 技术分享
- #include < iostream > using namespace std;
- int main(void) {
- int n,
- t;
- while (cin >> t) {
- while (t--) {
- cin >> n;
- int p = 1,
- q = 3;
- for (int i = 2; i < n; i++) {
- int y = q;
- q = p * 2 + q;
- p = y;
- }
- if (n == 1) cout << p << endl;
- else if (n == 2) cout << q << endl;
- else cout << q << endl;
- }
- }
- return 0;
- }
HDU-2190 悼念 512 汶川大地震遇难同胞——重建希望小学
来源: http://www.bubuko.com/infodetail-2167635.html