zoukankan      html  css  js  c++  java
  • 一下午的编程思索录

    1.  

    Rikka with Coin

    美国货币由美元dollar和美分cent组成,one dollar等于100 cents.

    其纸币bill有一、二、五、十、二十、五十和一百美元等面值;

    硬币(coin)有一美分(或a penny)、五美分(或a nickel)、十美分(或a dime)和二十五美分(或a quarter)等.

    在数字前加$表示美元,如:$500表示五百美元;在数字后加C表示美分,如:50C表示50美分;表示由美元和美分组成的钱数时,常用$表示,如:$6.50.

    Problem Description:

    In the local currency system, there are 4 kinds of coins: 10 cents, 20 cents, 50 cents and 1 dollar.

    1 dollar == 100 cents.

    最优化问题

    2.

    Rikka with Game

    在两百次回眸之后!

    optimally:最优地

    Given a string s with only lowercase letters。

    need to operate the string in turns while the first operation is 

    terminate:

    (1).to end;to make sth end;

    (2).to end a journey/trip;

    Rikka wants to minimize the lexicographical order of the result;

    Yuta wants to maximize it;

    You are required to calculate the result of the game if both Rikka and Yuta play optimally.

    optimist:乐天派

    in each turn:

    in turn:依次,轮流。

    The tide is turning:涨潮了_____,

    His luck is on the turn.___________他要时来运转了~。

    #include<iostream>
    using namespace std;
    int main()
    {
        int T;
        cin>>T;
        while(T--)
        {
            string a;
            cin>>a;
            int len=a.length();
            int b;
            
            for(int i=0;i<len;i++)
            {
                if(a[i]=='y')
                {
                    continue;
                }
                else
                {
                    b=i;
                    break;
                }
            }				//orz,寻找第一个非'y'的字符。 
            if(a[b]=='z')	//判断此字符是否为z。 
            {
                a[b]='b';
            }
            
            cout<<a<<endl;
        }
    }
    

    思维+博弈!  

     

  • 相关阅读:
    Java多线程学习笔记
    Java核心技术(卷二)
    学习问题记录
    Java Web 学习杂记
    Java Web 学习笔记
    正则表达式学习记录
    k8s与docker版本依赖关系
    docker commit采坑记录
    关于docker的配置文件与环境变量的小发现
    搭建怎么搭建独立的sftp服务
  • 原文地址:https://www.cnblogs.com/dragondragon/p/11380132.html
Copyright © 2011-2022 走看看