栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > C/C++/C#

2021 ICPC Gran Premio de Mexico 2da Fecha(C,D,G,I)

C/C++/C# 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

2021 ICPC Gran Premio de Mexico 2da Fecha(C,D,G,I)

题目
  • C. Cut the Deck
  • D. Dislike the Raisins
  • G. Grid of Letters
  • I. Integer Multiplicative Persistence

C. Cut the Deck

链接:link.
思路:找出max(R的数量-B的数量),从此处开始便利,n/2-d1[ i ] (B的数量)>=max,i即为所求。

int t;
char s[1000010];
int d1[1000010],d2[1000010];
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    cin>>t;
    while(t--)
    {
        cin>>s;
        int n=strlen(s);
        int k1=0,k2=0;
        int flag=0;
        int maxn=-INF,maxf=-1;
        for(int i=0;imaxn)maxf=i,maxn=k2-k1;
        }
        if(flag==0){cout<<"0n";continue;}
        for(int i=maxf;i=maxn)
            {
                cout< 
D. Dislike the Raisins 

链接:link.
注意:只要(c+r)%s!=0&&c%s>=(c+r)%s,结果一就为(c/s)++;

int t;
int c,r,s;
int main()
{
    ios::sync_with_stdio(0);
    //cin.tie(0);cout.tie(0);
    cin>>t;
    while(t--)
    {
        cin>>c>>r>>s;
        int x=(c+r)/s;
        int y=(c+r)%s;
        int s1=c/s,s2;
        if(y!=0&&c%s>=y)s1++;
        if(y!=0)x++;
        if(x<=r)s2=0;
        else s2=x-r;
        cout< 
G. Grid of Letters 

链接:link.
思路:找到入度为0的点开始dfs,注意特判终止dfs。

int n,m;
char s[1010][1010];
typedef pairPII;
vectorv;
int dx[]={1,1,1,-1,-1,-1,0,0};
int dy[]={1,0,-1,1,0,-1,1,-1};
void dfs(int x,int y,int ss,int &maxn)
{
    for(int i=0;i<8;i++)
    {
        int cx=x+dx[i];
        int cy=y+dy[i];
        if(cx>=0&&cx=0&&cy>n>>m;
    for(int i=0;i>s[i];
    //for(int i=0;i=0&&x=0&&ymaxn)dfs(x,y,ss,maxn);
    }
    cout< 
I. Integer Multiplicative Persistence 

链接:link.

int t,n;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    cin>>t;
    while(t--)
    {
        cin>>n;
        int k=0;
        while(n>9)
        {
            k++;
            int x=1;
            while(n>0)
            {
                x=x*(n%10);
                n=n/10;
            }
            n=x;
        }
        cout<
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/289527.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号