CF1101A Minimum Integer 模拟】的更多相关文章

题意翻译 题意简述 给出qqq组询问,每组询问给出l,r,dl,r,dl,r,d,求一个最小的正整数xxx满足d∣x d | x\ d∣x 且x̸∈[l,r] x \not\in [l,r]x̸∈[l,r] 输入格式 第一行一个正整数q(1≤q≤500)q(1 \leq q \leq 500)q(1≤q≤500) 接下来qqq行每行三个正整数l,r,d(1≤l≤r≤109,1≤d≤109)l,r,d(1 \leq l \leq r \leq 10^9 , 1 \leq d \leq 10^9)l…
You are given qq queries in the following form: Given three integers lili, riri and didi, find minimum positive integer xixi such that it is divisible by didi and it does not belong to the segment [li,ri][li,ri]. Can you answer all the queries? Recal…
import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; public class Doudizhu { public static void main(String[]args){ //存放扑克牌 //牌类+对应花色 HashMap<Integer, String> pooker = new HashMap<Integer,String>(); //牌的编号 ArrayL…
链接: https://codeforces.com/contest/1251/problem/C 题意: You are given a huge integer a consisting of n digits (n is between 1 and 3⋅105, inclusive). It may contain leading zeros. You can swap two digits on adjacent (neighboring) positions if the swappi…
C. Minimize The Integer time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output You are given a huge integer a consisting of n digits (n is between 1 and 3⋅105, inclusive). It may contain leading zero…
A. Minimum Integer 水 #include<bits/stdc++.h> #define clr(a,b) memset(a,b,sizeof(a)) using namespace std; typedef long long ll; ; struct node{ ll num,mag; friend bool operator <(const node &a,const node &b){ return a.mag>b.mag; } }a[max…
A. Search for Pretty Integers You are given two lists of non-zero digits. Let's call an integer pretty if its (base 10) representation has at least one digit from the first list and at least one digit from the second list. What is the smallest positi…
Educational Codeforces Round 58 (Rated for Div. 2)  题目总链接:https://codeforces.com/contest/1101 A. Minimum Integer 题意: 多组数据,给你三个数l,r,d,要求在区间[l,r]之外找一个最小的x,使得x%d==0. 题解: 当d<l or d>r的时候,直接输出d就好了. 当l<=d<=r的时候,找到最小的t,使得t*d>r就行了. 具体操作见代码: #include…
感慨 这次比较昏迷最近算法有点飘,都在玩pygame...做出第一题让人hack了,第二题还昏迷想错了 A Minimum Integer(数学) 水题,上来就能做出来但是让人hack成了tle,所以要思考一下具体的过程 原本我是认为直接把d进行累加看什么时候不在那个segment内也就是那个范围之内结果tle 今天思考一下发现有两种情况 ①如果d本来就是小于左边界的那么就输出d就可以了,因为样例明确提示有原来的数也可以 ②然后就是如果d在范围之内或者范围外可以用余数来确定具体的数公式是: an…
A. Fair Game time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Petya and Vasya decided to play a game. They have n cards (n is an even number). A single integer is written on each card. Befor…