AtCoder Beginner Contest 233

题目链接

A - 10yen Stamp

题目大意:给定两个数X、Y,问X加多少个10,使得X >= Y
考点:向上取余

#include 
#include 
using namespace std;
int main(void)
{
   
    int a, b;
    cin >> a >> b;
    int t = b - a;
    int ans = 0;
    if(t <= 0) cout << ans << endl;
    else cout << (t + 9) / 10 << endl;;
}

B - A Reverse

给定L、R,和字符串S,将S的[L, R] 翻转,输出

#include 
#include 
using namespace std;
int main(void)
{
   
    int a, b;
    string str;
    cin >> a >> b >> str;
    string temp;
    temp = str.substr(a - 1, b - a + 1);
    //cout << temp <
    reverse(temp.begin(), temp.end());
    for(int i = 0; i < a - 1; i ++) cout << str[i]

你可能感兴趣的:(AtCoder,AtCoder)