20pts求调!!

P10836 『FLA - I』歌静河

man_8_24 @ 2024-10-17 10:17:08

rt

20分代码如下

#include <bits/stdc++.h>
#define int long long
using namespace std;
char tmp;
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0),cout.tie(0);
    int n,m,tshuzujinhaodegeshu=0;
    string s,t;
    cin>>n>>m;
    cin>>s>>t;
    tmp='a';
    for(int i=0;i<n;i++)
    {
        if(t[i]=='#')
        {
            tshuzujinhaodegeshu++;
        }
    }
    for(int i=0;i<n;i++)
    {
        if(s[i]=='#')
        {
            if(tmp!='a'&&tshuzujinhaodegeshu>='z'-tmp)
            {
                tshuzujinhaodegeshu-='z'-tmp;
                tmp='a';
            }   
            s[i]=tmp;
            if(tmp=='z')tmp='a';
            else if(tmp=='a')tmp+=2;
        }
    }
    cout<<s; 
    return 0;
}

by yingxi @ 2024-10-17 10:18:57

好好好,不听课是吧


by yingxi @ 2024-10-17 10:19:40

老师都讲完了


by ATION001 @ 2024-10-17 10:19:42

惨,我写歪解都有 60 分。


by yingxi @ 2024-10-17 10:20:36

@man_8_24 不听课的后果


by AC_zzh2013 @ 2024-10-17 10:21:03

#include<bits/stdc++.h>
#define int long long
using namespace std;
char s[100005];
signed main()
{
    int n,m;
    cin>>n>>m;
    string a,b;
    cin>>a>>b;
    int f=0;
    int sd=0;
    int sum=0;
    for(int i=0;i<n;++i)
    {
        if(a[i]=='#' and f==0)
        {
            sd=i;
            f=1;
        }
        if(b[i]=='#')
        {
            sum++;
        }
    }
    int c=0;
    char ans;
    for(int i=0;i<n;++i)
    {
        if(a[i]!='#')
        {
            cout<<a[i];
        }
        else
        {
            if(i==sd)
            {
                c++;
                ans='a';
                cout<<ans;
                continue;
            }
            if(sum+c>=26)
            {
                sum-=(26-c);
                c=1;
                ans='a';
                cout<<ans;
            }
            else
            {
                c++;
                ans='a'+(c-1)%26;
                cout<<ans;
            }
        }
    }
    return 0;
}

by Baichuzhi @ 2024-10-17 10:21:12

@man_8_24 呵呵,变量名太长 + 不听课,你当然写不出来啦~~


by man_8_24 @ 2024-10-17 10:21:55

@Baichuzhi @yingxi 不是你们都拿到分数了吗,叫什么啊


by yingxi @ 2024-10-17 10:22:07

@AC_zzh2013 不要管这个不听课的巨佬


by Baichuzhi @ 2024-10-17 10:22:11

@man_8_24 呵呵,100分


by dengruijie2 @ 2024-10-17 10:22:46

@man_8_24 不听课还求助,活该


| 下一页