Educational Codeforces Round 81 (Rated for Div. 2) ADisplay The Number

Posted awcxv

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Educational Codeforces Round 81 (Rated for Div. 2) ADisplay The Number相关的知识,希望对你有一定的参考价值。

题目链接

【题解】


优先用2个棒子来凑1.
如果为奇数的话,多出来一根用3根来凑个7放在开头

【代码】

#include <bits/stdc++.h>
using namespace std;



int main(){
    #ifdef LOCAL_DEFINE
        freopen("E:\rush.txt","r",stdin);
    #endif // LOCAL_DEFINE
    ios::sync_with_stdio(0),cin.tie(0);
    int T;
    cin >> T;
    while (T--){
        int n;
        cin >> n;
        if (n&1){
            cout<<7;
            n-=3;
        }
        for (int i = 1;i <= n/2;i++) cout<<1;
        cout<<endl;
    }
    return 0;
}

以上是关于Educational Codeforces Round 81 (Rated for Div. 2) ADisplay The Number的主要内容,如果未能解决你的问题,请参考以下文章

Educational Codeforces Round 7 A

Educational Codeforces Round 7

Educational Codeforces Round 90

Educational Codeforces Round 33

Codeforces Educational Codeforces Round 54 题解

Educational Codeforces Round 27