码迷,mamicode.com
首页 > 其他好文 > 详细

一下午的编程思索录

时间:2019-08-19 23:10:37      阅读:119      评论:0      收藏:0      [点我收藏+]

标签:term   required   view   alt   iostream   图片   str   pen   letter   

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

思维+博弈!  

 

 

 

 

 

 

一下午的编程思索录

标签:term   required   view   alt   iostream   图片   str   pen   letter   

原文地址:https://www.cnblogs.com/dragondragon/p/11380132.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!