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;
        }
    }
    

    思维+博弈!  

     

  • 相关阅读:
    cookie的使用
    给定一个数组和一个目标值,找出和为目标值的整数,并返回他们的下标
    String详解
    阳哥讲面试题(四)生产调优
    springboot项目调优(针对特性的服务启动,定制化诉求)
    intern() 方法
    阳哥讲面试题(四)OOM,GC算法,垃圾收集器
    阳哥讲面试题(三)JVM,GC
    阳哥讲面试题(二)队列,线程池
    Semaphore用法
  • 原文地址:https://www.cnblogs.com/dragondragon/p/11380132.html
Copyright © 2011-2022 走看看