【Educational Codeforces Round 81 (Rated for Div. 2) A】Display 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;
}

posted @ 2020-01-30 08:23  AWCXV  阅读(...)  评论(...编辑  收藏