遇见模拟题 有两种做法 例如这题: 1.直接去算次数(统计哪个数在第几位,然后去运算) 2.模拟操作 贴一个别人的代码...https://blog.csdn.net/weixin_39453270/article/details/80548780 #include <bits/stdc++.h> using namespace std; const int INF=0x3f3f3f3f; string str1,str2; ; void Get(char a,char b,int n,int…
You are given an integer nn from 11 to 10181018 without leading zeroes. In one move you can swap any two adjacent digits in the given number in such a way that the resulting number will not contain leading zeroes. In other words, after each move the…
You are given an integer nn from 11 to 10181018 without leading zeroes. In one move you can swap any two adjacent digits in the given number in such a way that the resulting number will not contain leading zeroes. In other words, after each move the…
Codeforces Round #486 (Div. 3) E. Divisibility by 25 题目连接: http://codeforces.com/group/T0ITBvoeEx/contest/988/problem/E Description You are given an integer n from 1 to 10^18 without leading zeroes. In one move you can swap any two adjacent digits in…
Divisibility by 25 time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You are given an integer nn from 11 to 10181018 without leading zeroes. In one move you can swap any two adjacent digits i…
解题思路: 只有尾数为25,50,75,00的数才可能是25的倍数. 对字符串做4次处理,以25为例. a. 将字符串中的最后一个5移到最后一位.计算交换次数.(如果没有找到5,则不可能凑出25,考虑50.75.00) b. 字符串已经改变,将此时最后一个2移到倒数第二位.计算交换次数. (如果没有找到2,则也不可能凑出25,考虑50.75.00) c. 将除了最后两位之外的第一个非0的数字移到首位,计算交换次数.(如果找不到除了最后两位之外的非0数字,则不可能凑出25,考虑50.75.00)…
传送门 题意:给定一个数,可以对其做交换相邻两个数字的操作.问最少要操作几步,使得可以被25整除. 思路:问题可以转化为,要做几次交换,使得末尾两个数为00或25,50,75: 自己一开始就是先for一遍,记录四种可能对于的步数,再对四种可能讨论(有前导0的情况):自己是在数据中,该对了自己的代码, 看了队长和%王宣凯的代码,觉得那才是现场能ac的思路.--暴力交换: #include <iostream> #include <cstdio> #include <algori…
Prison Transfer Time Limit: 1000MS   Memory Limit: 262144KB   64bit IO Format: %I64d & %I64u Submit Status Description The prison of your city has n prisoners. As the prison can't accommodate all of them, the city mayor has decided to transfer c of t…
Marathon Time Limit: 1000MS   Memory Limit: 262144KB   64bit IO Format: %I64d & %I64u Submit Status Description Valera takes part in the Berland Marathon. The marathon race starts at the stadium that can be represented on the plane as a square whose…
点球大战(penalty) Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://acm.uestc.edu.cn/#/problem/show/25 Description 在足球比赛中,有不少赛事,例如世界杯淘汰赛和欧洲冠军联赛淘汰赛中,当比赛双方经过正规比赛和加时赛之后仍然不分胜负时,需要进行点球大战来决定谁能够获得最终的胜利.点球大战的规则非常简单,两方轮流派出球员罚点球,每方各罚5个.当5轮点球结束以后如果仍然不分胜负,则进入一轮定胜…