“葡萄城杯”牛客周赛 Round 53

A.[ 小红小紫投硬币](https://atcoder.jp/contests/abc365/tasks/abc365_a)

/*    ʕ•̀ ω • ʔ  *˘︶˘*).。.:*♡ (∗ᵒ̶̶̷̀ω˂̶́∗)੭₎₎̊₊♡ (⋈◍>◡<◍)       ʕ•̫͡• ʔ•̫͡•ཻʕ•̫͡•ʔ•͓͡•ʔ.•♫•♬ •♬•♫•.✿.。.:* ☆ .:**:.☆*.:。.✿  *★°*:.☆:*.°★*
●▂● ●0● ●︿● ●ω● ●﹏● ●△● ●▽●   ♡⃝ ʜᴇʟʟᴏ •ᴗ• ☽⋆
     ∩  ∩        ̋(๑˃́ꇴ˂̀๑)   ᐕ)⁾⁾  *:ஐ (๑´ᵕ`) ஐ:* *ଘ(੭*ˊᵕˋ)੭* (੭ˊᵕˋ)੭* ੈ✩˚
  >(>_<)<
    I   I
    I   I     ʕง•ᴥ•ʔง
    IU UI
   I     I          ꉂꉂ꒰•̤▿•̤*ૢ꒱
≧▂≦ ≧0≦ ≧︿≦ ≧ω≦ ≧﹏≦ ≧△≦ ꒰๑˃͈꒵˂͈๑꒱
☗♪叮☖叮♫ ☗铛♪ ☖♫☗♪叮☖叮♫ ☗铛♪ ☖♫☗♪叮☖叮♫ ☗铛♪ ☖♫☗♪叮☖叮♫ ☗铛♪ ☖♫
(~o▔▽▔)~o o~(▔▽▔o~)   ‿︵‿︵‿︵୨˚̣̣̣͙୧ - - - -୨˚̣̣̣͙୧‿︵‿︵‿︵
  */
#include<bits/stdc++.h>
using namespace std;
#define lll __int128
#define endl '\n'
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> PII;
const int mod=1e9+7;
inline ll read()
{
   ll x = 0, y = 1;
   char c = getchar();
   while (!isdigit(c))
   {
      if (c == '-')
         y = -1;
      c = getchar();
   }
   while (isdigit(c))
   {
      x = (x << 3) + (x << 1) + (c ^ 48);
      c = getchar();
   }
   return x *= y;
}
inline void write(ll x)
{
   if (x < 0)
      x = -x, putchar('-');
   ll sta[35], top = 0;
   do
      sta[top++] = x % 10, x /= 10;
   while (x);
   while (top)
      putchar(sta[--top] + '0');
}




void Miraitowa(){

   int n;
   cin >> n;
   printf("%.6f", 0.5);
}


int main(){
//  ios::sync_with_stdio(false);
//  cin.tie(0),cout.tie(0);
   // int t;
   // cin>>t;
   // while(t--)
      Miraitowa();
     return 0;
};


B.[小红的字符串](https://atcoder.jp/contests/abc365/tasks/abc365_b)

/*    ʕ•̀ ω • ʔ  *˘︶˘*).。.:*♡ (∗ᵒ̶̶̷̀ω˂̶́∗)੭₎₎̊₊♡ (⋈◍>◡<◍)       ʕ•̫͡• ʔ•̫͡•ཻʕ•̫͡•ʔ•͓͡•ʔ.•♫•♬ •♬•♫•.✿.。.:* ☆ .:**:.☆*.:。.✿  *★°*:.☆:*.°★*
●▂● ●0● ●︿● ●ω● ●﹏● ●△● ●▽●   ♡⃝ ʜᴇʟʟᴏ •ᴗ• ☽⋆
     ∩  ∩        ̋(๑˃́ꇴ˂̀๑)   ᐕ)⁾⁾  *:ஐ (๑´ᵕ`) ஐ:* *ଘ(੭*ˊᵕˋ)੭* (੭ˊᵕˋ)੭* ੈ✩˚
  >(>_<)<
    I   I
    I   I     ʕง•ᴥ•ʔง
    IU UI
   I     I          ꉂꉂ꒰•̤▿•̤*ૢ꒱
≧▂≦ ≧0≦ ≧︿≦ ≧ω≦ ≧﹏≦ ≧△≦ ꒰๑˃͈꒵˂͈๑꒱
☗♪叮☖叮♫ ☗铛♪ ☖♫☗♪叮☖叮♫ ☗铛♪ ☖♫☗♪叮☖叮♫ ☗铛♪ ☖♫☗♪叮☖叮♫ ☗铛♪ ☖♫
(~o▔▽▔)~o o~(▔▽▔o~)   ‿︵‿︵‿︵୨˚̣̣̣͙୧ - - - -୨˚̣̣̣͙୧‿︵‿︵‿︵
  */
#include<bits/stdc++.h>
using namespace std;
#define lll __int128
#define endl '\n'
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> PII;
const int mod=1e9+7;
inline ll read()
{
   ll x = 0, y = 1;
   char c = getchar();
   while (!isdigit(c))
   {
      if (c == '-')
         y = -1;
      c = getchar();
   }
   while (isdigit(c))
   {
      x = (x << 3) + (x << 1) + (c ^ 48);
      c = getchar();
   }
   return x *= y;
}
inline void write(ll x)
{
   if (x < 0)
      x = -x, putchar('-');
   ll sta[35], top = 0;
   do
      sta[top++] = x % 10, x /= 10;
   while (x);
   while (top)
      putchar(sta[--top] + '0');
}




void Miraitowa(){

   string s;
   cin >> s;

   ll cnt = 0;
   for (int i = 0; i < s.size()/2;i++){
      int a = s[i] - 'a', b = s[s.size() - 1 - i] - 'a';
         if(a>b)   swap(a, b);
         int res = b - a;
         res = min(res, (a - b + 26) % 26);
         cnt += res;
   }
   cout << cnt << endl;
}


int main(){
//  ios::sync_with_stdio(false);
//  cin.tie(0),cout.tie(0);
   // int t;
   // cin>>t;
   // while(t--)
      Miraitowa();
     return 0;
};


C.[小红的 01 消除](https://atcoder.jp/contests/abc364/tasks/abc364_c)

/*    ʕ•̀ ω • ʔ  *˘︶˘*).。.:*♡ (∗ᵒ̶̶̷̀ω˂̶́∗)੭₎₎̊₊♡ (⋈◍>◡<◍)       ʕ•̫͡• ʔ•̫͡•ཻʕ•̫͡•ʔ•͓͡•ʔ.•♫•♬ •♬•♫•.✿.。.:* ☆ .:**:.☆*.:。.✿  *★°*:.☆:*.°★*
●▂● ●0● ●︿● ●ω● ●﹏● ●△● ●▽●   ♡⃝ ʜᴇʟʟᴏ •ᴗ• ☽⋆
     ∩  ∩        ̋(๑˃́ꇴ˂̀๑)   ᐕ)⁾⁾  *:ஐ (๑´ᵕ`) ஐ:* *ଘ(੭*ˊᵕˋ)੭* (੭ˊᵕˋ)੭* ੈ✩˚
  >(>_<)<
    I   I
    I   I     ʕง•ᴥ•ʔง
    IU UI
   I     I          ꉂꉂ꒰•̤▿•̤*ૢ꒱
≧▂≦ ≧0≦ ≧︿≦ ≧ω≦ ≧﹏≦ ≧△≦ ꒰๑˃͈꒵˂͈๑꒱
☗♪叮☖叮♫ ☗铛♪ ☖♫☗♪叮☖叮♫ ☗铛♪ ☖♫☗♪叮☖叮♫ ☗铛♪ ☖♫☗♪叮☖叮♫ ☗铛♪ ☖♫
(~o▔▽▔)~o o~(▔▽▔o~)   ‿︵‿︵‿︵୨˚̣̣̣͙୧ - - - -୨˚̣̣̣͙୧‿︵‿︵‿︵
  */
#include<bits/stdc++.h>
using namespace std;
#define lll __int128
#define endl '\n'
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> PII;
const int mod=1e9+7;
inline ll read()
{
   ll x = 0, y = 1;
   char c = getchar();
   while (!isdigit(c))
   {
      if (c == '-')
         y = -1;
      c = getchar();
   }
   while (isdigit(c))
   {
      x = (x << 3) + (x << 1) + (c ^ 48);
      c = getchar();
   }
   return x *= y;
}
inline void write(ll x)
{
   if (x < 0)
      x = -x, putchar('-');
   ll sta[35], top = 0;
   do
      sta[top++] = x % 10, x /= 10;
   while (x);
   while (top)
      putchar(sta[--top] + '0');
}




void Miraitowa(){
   int n;
   string s;
   int x, y, z;
   cin >> n >> s >> x >> y >> z;
   int k = 0;
   for (int i = 0; i < s.size();i++)
       if(s[i]=='0')   break;
       else     k++;

   int cnt = 0, res = 0;
   for (int i = k; i < s.size();i++)
         if(s[i]=='0')    cnt++;
         else{
           if(cnt&&y)      res++, cnt--, y--;
         }
   cout << res << endl;
}


int main(){
//  ios::sync_with_stdio(false);
//  cin.tie(0),cout.tie(0);
   // int t;
   // cin>>t;
   // while(t--)
      Miraitowa();
     return 0;
};


D.[ 小红组比赛](https://atcoder.jp/contests/abc364/tasks/abc364_c)

/*    ʕ•̀ ω • ʔ  *˘︶˘*).。.:*♡ (∗ᵒ̶̶̷̀ω˂̶́∗)੭₎₎̊₊♡ (⋈◍>◡<◍)       ʕ•̫͡• ʔ•̫͡•ཻʕ•̫͡•ʔ•͓͡•ʔ.•♫•♬ •♬•♫•.✿.。.:* ☆ .:**:.☆*.:。.✿  *★°*:.☆:*.°★*
●▂● ●0● ●︿● ●ω● ●﹏● ●△● ●▽●   ♡⃝ ʜᴇʟʟᴏ •ᴗ• ☽⋆
     ∩  ∩        ̋(๑˃́ꇴ˂̀๑)   ᐕ)⁾⁾  *:ஐ (๑´ᵕ`) ஐ:* *ଘ(੭*ˊᵕˋ)੭* (੭ˊᵕˋ)੭* ੈ✩˚
  >(>_<)<
    I   I
    I   I     ʕง•ᴥ•ʔง
    IU UI
   I     I          ꉂꉂ꒰•̤▿•̤*ૢ꒱
≧▂≦ ≧0≦ ≧︿≦ ≧ω≦ ≧﹏≦ ≧△≦ ꒰๑˃͈꒵˂͈๑꒱
☗♪叮☖叮♫ ☗铛♪ ☖♫☗♪叮☖叮♫ ☗铛♪ ☖♫☗♪叮☖叮♫ ☗铛♪ ☖♫☗♪叮☖叮♫ ☗铛♪ ☖♫
(~o▔▽▔)~o o~(▔▽▔o~)   ‿︵‿︵‿︵୨˚̣̣̣͙୧ - - - -୨˚̣̣̣͙୧‿︵‿︵‿︵
  */
#include <bits/stdc++.h>
using namespace std;
#define lll __int128
#define endl '\n'
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> PII;
const int mod = 1e9 + 7;
inline ll read()
{
   ll x = 0, y = 1;
   char c = getchar();
   while (!isdigit(c))
   {
      if (c == '-')
         y = -1;
      c = getchar();
   }
   while (isdigit(c))
   {
      x = (x << 3) + (x << 1) + (c ^ 48);
      c = getchar();
   }
   return x *= y;
}
inline void write(ll x)
{
   if (x < 0)
      x = -x, putchar('-');
   ll sta[35], top = 0;
   do
      sta[top++] = x % 10, x /= 10;
   while (x);
   while (top)
      putchar(sta[--top] + '0');
}

const int N = 110;
int a[N][N], f[N][5050];
int n, m;
int target;
int ans = INT_MAX;

void Miraitowa()
{
   cin >> n >> m;
   for (int i = 1; i <= n; i++)
      for (int j = 1; j <= m; j++)
         cin >> a[i][j];

   cin >> target;
   f[0][0] = 1;

   for (int i = 1; i <= n;i++)
      for (int j = 1; j <= m;j++)
         for (int k = a[i][j]; k <= 5050;k++)
            f[i][k] += f[i - 1][k - a[i][j]];

            for (int i = 0; i <= 5050; i++)
               if (f[n][i])      ans = min(ans, abs(i - target));
   cout << ans << endl;
}

int main()
{
   ios::sync_with_stdio(false);
   cin.tie(0), cout.tie(0);
   // int t;
   // cin>>t;
   // while(t--)
   Miraitowa();
   return 0;
};

  • 7
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值