- 博客(12)
- 收藏
- 关注
原创 2021-08-07
给定三个整数 x、y 和 n。 你的任务是找到最大整数 k 使得 kmodx=y(0≤k≤n),其中 mod 是模运算。#include<bits/stdc++.h>using namespace std;typedef long long ll;const int maxn = 1e5 + 9;int a[maxn]; int main(){ ll n,x,y; int t; scanf("%d",&t); while(t--) { ll k; sc
2021-08-07 11:16:04 111
原创 J 题 Counting Triangles
传送门Goodeat finds an undirected complete graph with n vertices. Each edge of the graph is painted black or white. He wants you to help him findthe number of triangles (a, b, c) (a < b < c), such that the edges between (a, b), (b, c), (c, a) have the
2021-07-26 09:24:56 169
原创 计算几何学习
一、计算几何基础1.圆P1652给出 n个圆,保证任意两个圆都不相交。 然后给出两个点(x1,y1),(x2,y2),保证均不在某个圆上,要从 (x1,y1) 到(x2,y2)画条曲线,问这条曲线最少穿过多少次圆的边界?输入格式第一行为一个整数 n,表示圆的个数;第二行是 n 个整数,表示 n个圆的 x 坐标;第三行是 n 个整数,表示 n个圆的 y 坐标;第四行是 n 个整数,表示 n 个圆的半径 r;第五行是四个整数x1,y1,x2,y2;输出格式仅一个整数,表示最少要
2021-07-22 10:34:14 208
原创 Maximal submatrix
杭电多校Problem DescriptionGiven a matrix of n rows and m columns,find the largest area submatrix which is non decreasing on each columnInputThe first line contains an integer T(1≤T≤10)representing the number of test cases.For each test case, the first
2021-07-20 17:21:52 216
原创 博弈论模板
一、巴士博弈只有一堆n个物品,两个人轮流从中取物,规定每次最少取一个,最多取m个,最后取光者为胜。#include <iostream>using namespace std;int main(){ int n,m; while(cin>>n>>m) if(n%(m+1)==0) cout<<"后手必胜"<<endl; else cout<<"先手必胜"<<endl;
2021-07-17 18:38:56 223
原创 B - The Child and Set
传送门At the children’s day, the child came to Picks’s house, and messed his house up. Picks was angry at him. A lot of important things were lost, in particular the favorite set of Picks.Fortunately, Picks remembers something about his set S:its elements
2021-04-26 21:16:37 161
原创 a的b次方和c的d次方比较
a的b次方和c的d次方比较题目传送门As we all now that there’s a easy way to describe some same consecutive factors multiply each other which is POW.For example,2×2×2=233×3=32it is easy to see that 23 < 32Now, your math teacher just gave you a problem in his class
2021-02-08 16:50:30 1097
原创 1100.字符串查找
sdun 1100Description给定两个字符串a、b,求b在a中出现的位置.Input第一行为一个字符串a,长度大于等于1小于等于100000。第二行为一个字符串b,长度大于等于1小于等于1000。Output一个整数,b在a中出现的位置,若b不是a的字串,输出-1。Sample Inputabababc ababcSample Output3这里用的string 中的 substr 函数substr是C++语言函数,主要功能是复制子字符串,要求从指定位
2021-01-24 15:03:05 556 1
原创 B - String LCM
B - String LCM题目Let’s define a multiplication operation between a string a and a positive integer x: a⋅x is the string that is a result of writing x copies of a one after another. For example, “abc” ⋅ 2 = “abcabc”, “a” ⋅ 5 = “aaaaa”.A string a is divisi
2021-01-22 17:28:39 400 2
原创 Uva-10815输入一个文本,找出所有不同的单词
Uva-10815参考博客:zuiaimiusi题目大意:输入一个文本,找出所有不同的单词,按字典序从大到小输出,单词不区分大小写。Andy, 8, has a dream - he wants to produce his very own dictionary. This is not an easy task for him, as the number of words that he knows is,well, not quite enough. Instead of thinking
2021-01-20 21:52:48 322
转载 N皇后问题
N皇后问题在N*N的方格棋盘放置了N个皇后,使得它们不相互攻击(即任意2个皇后不允许处在同一排,同一列,也不允许处在与棋盘边框成45角的斜线上。你的任务是,对于给定的N,求出有多少种合法的放置方法。input共有若干行,每行一个正整数N≤10,表示棋盘和皇后的数量;如果N=0,表示结束。output共有若干行,每行一个正整数,表示对应输入行的皇后的不同放置数量。Sample Input1850Sample Output19210参考的博客 白马游侠递归
2020-11-13 20:52:00 127
原创 1012.区间合并
##1012.区间合并Description给定n个开区间,合并他们中的重合者,输出合并后的区间数量。Input第一行:n(1 <= n <= 1000)第2至第n+1行:每行两个整数(不会超过int),第i行的两个整数表示第i-1个区间的左边界和右边界。Output合并后所剩余的区间数量。Sample Input31 32 56 7Sample Output21.运用结构体2.将左端点进行升序排列3.比较相邻区间的右端点,若前一个比后
2020-11-02 20:53:58 199
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人