AcWing 第 98 场周赛 ABC

https://www.acwing.com/activity/content/competition/problem_list/3128/

4947. 大整数

题目大意:

给定n,k。输出n个k。
输入样例:
3 2
输出样例:
222
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> PII;
const LL MAXN=1e18,MINN=-MAXN,INF=0x3f3f3f3f;
const LL N=1e6+10,M=2023;
const LL mod=100000007;
const double PI=3.1415926535;
#define endl '\n'
int main()
{
    cin.tie(0); cout.tie(0); ios::sync_with_stdio(false);
    LL T=1;
    //cin>>T;
    while(T--)
    {
        LL n,k;
        cin>>n>>k;
        for(int i=1;i<=n;i++)
        {
            cout<<k;
        }
    }
    return 0;
}

4948. 大乘积

输入样例1:
3
5 10 1
输出样例1:
50
输入样例2:
4
1 1 10 11
输出样例2:
110
输入样例3:
5
0 3 1 100 1
输出样例3:
0
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> PII;
const LL MAXN=1e18,MINN=-MAXN,INF=0x3f3f3f3f;
const LL N=1e6+10,M=2023;
const LL mod=100000007;
const double PI=3.1415926535;
#define endl '\n'
string s[N];
int main()
{
    cin.tie(0); cout.tie(0); ios::sync_with_stdio(false);
    LL T=1;
    //cin>>T;
    while(T--)
    {
        LL n;
        cin>>n;
        for(int i=1;i<=n;i++)
        {
            cin>>s[i];
        }
        LL sum=0;
        string beg="1";
        for(int i=1;i<=n;i++)
        {
            if(s[i]=="0")
            {
                cout<<"0";
                return 0;
            }
            else
            {
                bool flag=true;
                LL zero=0;
                for(int j=0;j<s[i].size();j++)
                {
                    if(j>=1&&s[i][j]=='0') zero++;
                }
                if(s[i][0]!='1'||zero!=s[i].size()-1) flag=false;
                if(flag==false) beg=s[i];
                else sum+=s[i].size()-1;
            }
        }
        cout<<beg;
        for(int i=1;i<=sum;i++)
        {
           cout<<"0";
        }
    }
    return 0;
}

4949. 末尾连续0

输入样例1:
1
输出样例1:
5
5 6 7 8 9 
输入样例2:
5
输出样例2:
0
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> PII;
const LL MAXN=1e18,MINN=-MAXN,INF=0x3f3f3f3f;
const LL N=1e6+10,M=2023;
const LL mod=100000007;
const double PI=3.1415926535;
#define endl '\n'
LL mp[10];
int main()
{
    cin.tie(0); cout.tie(0); ios::sync_with_stdio(false);
    LL T=1;
    //cin>>T;
    while(T--)
    {
        LL m;
        cin>>m;
        vector<LL> v;
        for(LL i=1;i<=1e7;i++)
        {
            LL t=i;
            while(t%2==0) mp[2]++,t/=2;
            while(t%5==0) mp[5]++,t/=5;
            if(min(mp[2],mp[5])==m) v.push_back(i);
        }
        cout<<v.size()<<endl;
        for(int i:v)
        {
            cout<<i<<" ";
        }
    }
    return 0;
}
posted @ 2023-04-09 20:52  Vijurria  阅读(6)  评论(0编辑  收藏  举报