题意: 我们在研究罗马数字.罗马数字只有4个字符,I,V,X,L分别代表1,5,10,100.一个罗马数字的值为该数字包含的字符代表数字的和,而与字符的顺序无关.例如XXXV=35,IXI=12. 现在求问一个长度为 nnn 的罗马数字可以有多少种不同的值. n<=109n<=10^9n<=109. 题解: 我们可以用暴力的方法求出前20项的值,其中前111111 项采用打表的方式,而从第12项开始答案始终 = 前一项的答案 + 49,即 292+(n−11)∗49292+(n-11)*…
D. Roman Digits time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Let's introduce a number system which is based on a roman digits. There are digits I, V, X, L which correspond to the numbers…
A. Laptops time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the…
// Codeforces Round #365 (Div. 2) // C - Chris and Road 二分找切点 // 题意:给你一个凸边行,凸边行有个初始的速度往左走,人有最大速度,可以停下来,竖直走. // 问走到终点的最短时间 // 思路: // 1.贪心来做 // 2.我觉的二分更直观 // 可以抽象成:一条射线与凸边行相交,判断交点.二分找切点 #include <bits/stdc++.h> using namespace std; #define LL long lon…
C - Convert to Ones 给你一个01串 x是反转任意子串的代价 y是将子串全部取相反的代价 问全部变成1的最小代价 两种可能 一种把1全部放到一边 然后把剩下的0变成1  要么把所有的 0 直接变成1 #include<bits/stdc++.h> using namespace std; #define LL long long int main(){ LL n,x,y; string a; cin>>n>>x>>y>>a; ;…
目录 Codeforces 998 A.Balloons B.Cutting C.Convert to Ones D.Roman Digits E.Sky Full of Stars(容斥 计数) Codeforces 998 比赛链接 A.Balloons 输出啥看错WA\(*2\)+第一次写sort写了cmp()但是没加cmpWA\(*2\)(结构体重载运算符后遗症).. 没谁了. #include <cstdio> #include <cctype> #include <…
Roman and Numbers time limit per test 4 seconds memory limit per test 512 megabytes input standard input output standard output Roman is a young mathematician, very famous in Uzhland. Unfortunately, Sereja doesn't think so. To make Sereja change his…
题目链接: http://codeforces.com/problemset/problem/401/D D. Roman and Numbers time limit per test4 secondsmemory limit per test512 megabytes 问题描述 Roman is a young mathematician, very famous in Uzhland. Unfortunately, Sereja doesn't think so. To make Sere…
D. Roman and Numbers time limit per test 4 seconds memory limit per test 512 megabytes input standard input output standard output Roman is a young mathematician, very famous in Uzhland. Unfortunately, Sereja doesn't think so. To make Sereja change h…
链接: https://codeforces.com/contest/1228/problem/A 题意: You have two integers l and r. Find an integer x which satisfies the conditions below: l≤x≤r. All digits of x are different. If there are multiple answers, print any of them. 思路: 水题. 代码: #include…