BestCoder Round #11 (Div. 2)题解集合_html/css_WEB-ITnose
Alice and Bob Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 155 Accepted Submission(s): 110
Problem Description
Bob and Alice got separated in the Square, they agreed that if they get separated, they'll meet back at the coordinate point (x, y). Unfortunately they forgot to define the origin of coordinates and the coordinate axis direction. Now, Bob in the lower left corner of the Square, Alice in the upper right corner of the the Square. Bob regards the lower left corner as the origin of coordinates, rightward for positive direction of axis X, upward for positive direction of axis Y. Alice regards the upper right corner as the origin of coordinates, leftward for positive direction of axis X, downward for positive direction of axis Y. Assuming that Square is a rectangular, length and width size is N * M. As shown in the figure:
Bob and Alice with their own definition of the coordinate system respectively, went to the coordinate point (x, y). Can they meet with each other ?
Note: Bob and Alice before reaching its destination, can not see each other because of some factors (such as buildings, time poor).
Input
There are multiple test cases. Please process till EOF. Each test case only contains four integers : N, M and x, y. The Square size is N * M, and meet in coordinate point (x, y). ( 0
Output
If they can meet with each other, please output "YES". Otherwise, please output "NO".
Sample Input
<p class="sycode"> 10 10 5 510 10 6 6 </p>
Sample Output
<p class="sycode"> YESNO </p>
Source
BestCoder Round #11 (Div. 2)
Recommend
heyang | We have carefully selected several similar problems for you: 5053 5052 5051 5050 5049
题意:
给一个矩形区域告诉你它的长和宽。然后两个坐标系。一个为左下角为原点。右上为正方向。一个右上角为原点。右下为正方向。现在给你一个坐标(x,y)问你在两种坐标系中他们是不是表示同一个点。
思路:
把不同的坐标系转换到同一坐标系就行了。我是把左上角转换到右下角的。
详细见代码:
#include<algorithm>#include<iostream>#include<string.h>#include<stdio.h>using namespace std;const int INF=0x3f3f3f3f;const int maxn=100010;typedef long long ll;int main(){ int n,m,x,y; while(~scanf("%d%d%d%d",&n,&m,&x,&y)) { if(x==n-x&&y==m-y) printf("YES\n"); else printf("NO\n"); } return 0;}</stdio.h></string.h></iostream></algorithm>
Bob and math problem Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 456 Accepted Submission(s): 169
Problem Description
Recently, Bob has been thinking about a math problem.
There are N Digits, each digit is between 0 and 9. You need to use this N Digits to constitute an Integer.
This Integer needs to satisfy the following conditions:
Example:
There are three Digits: 0, 1, 3. It can constitute six number of Integers. Only "301", "103" is legal, while "130", "310", "013", "031" is illegal. The biggest one of odd Integer is "301".
Input
There are multiple test cases. Please process till EOF.
Each case starts with a line containing an integer N ( 1 The second line contains N Digits which indicate the digit $a_1, a_2, a_3, \cdots, a_n. ( 0 \leq a_i \leq 9)$.
Output
The output of each test case of a line. If you can constitute an Integer which is satisfied above conditions, please output the biggest one. Otherwise, output "-1" instead.
Sample Input
<p class="sycode"> 30 1 335 4 232 4 6 </p>
Sample Output
<p class="sycode"> 301425-1 </p>
Source
BestCoder Round #11 (Div. 2)
Recommend
heyang | We have carefully selected several similar problems for you: 5053 5052 5051 5050 5049
题意:
给你n个数字要你组成 n位数的最大的一个奇数。不行就输出-1.
思路:
开始读错题意了。以为输出的不一定要用到所有数字。于是判完后就挂了。真搞不懂怎么过开始的数据的。。。
这题贪心构造就行了。先找一个最小的奇数来做个位如果没有的话就-1。然后把剩下的数排序。如果剩下的还有数字且最大的为0的话肯定输出-1了。不是的话就按降序输出在加上那会找的奇数就行了。
详细见代码:
#include<algorithm>#include<iostream>#include<string.h>#include<stdio.h>using namespace std;const int INF=0x3f3f3f3f;const int maxn=100010;typedef long long ll;int arr[150],brr[150];int main(){ int n,i,p,ct; while(~scanf("%d",&n)) { ct=0,p=-1; for(i=0;i<n scanf if p="i;" printf continue for brr sort>=0;i--) printf("%d",brr[i]); printf("%d\n",arr[p]); } return 0;}</n></stdio.h></string.h></iostream></algorithm>
Boring count Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 250 Accepted Submission(s): 98
Problem Description
You are given a string S consisting of lowercase letters, and your task is counting the number of substring that the number of each lowercase letter in the substring is no more than K.
Input
In the first line there is an integer T , indicates the number of test cases.
For each case, the first line contains a string which only consist of lowercase letters. The second line contains an integer K.
[Technical Specification]
1 1 1
Output
For each case, output a line contains the answer.
Sample Input
<p class="sycode"> 3abc1abcabc1abcabc2 </p>
Sample Output
<p class="sycode"> 61521 </p>
Source
BestCoder Round #11 (Div. 2)
Recommend
heyang | We have carefully selected several similar problems for you: 5053 5052 5051 5050 5049
题意:
给你一个长度不超过1e5由小写组成的字符串。问你它有多少个子串。满足子串的每个字符出现的次数都不超过k。
思路:
对于一个满足条件的左端点le。把右端点ri的字符一个一个的加进去。如果还是满足条件。这个新加进的字符将会贡献ri-le+1个以该子符为右端点的子串。如果不满足条件了就左移le指针知道满足条件即可。比赛时早就想到思路了。可各种逻辑错误1小时+才1A。
详细见代码:
#include<algorithm>#include<iostream>#include<string.h>#include<stdio.h>using namespace std;const int INF=0x3f3f3f3f;const int maxn=100002;typedef long long ll;char txt[maxn];int vis[27];ll ans=0;int main(){ int t,n,k,le,ri,p; scanf("%d",&t); while(t--) { scanf("%s%d",txt,&k); n=strlen(txt); ans=le=ri=0; memset(vis,0,sizeof vis); p=-1; while(rik) p=ri; else if(ri<n ans ri else vis if p="-1,ans+=ri-le-1;" le printf return> <br> Argestes and Sequence <strong>Time Limit: 5000/2500 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)<br> Total Submission(s): 192 Accepted Submission(s): 44<br> </strong> <br> <br> <p class="sycode"> Problem Description </p> <p class="sycode"> Argestes has a lot of hobbies and likes solving query problems especially. One day Argestes came up with such a problem. You are given a sequence a consisting of N nonnegative integers, a[1],a[2],...,a[n].Then there are M operation on the sequence.An operation can be one of the following: <br> S X Y: you should set the value of a[x] to y(in other words perform an assignment a[x]=y). <br> Q L R D P: among [L, R], L and R are the index of the sequence, how many numbers that the Dth digit of the numbers is P. <br> Note: The 1st digit of a number is the least significant digit. </p> <p class="sycode"> </p> <br> <p class="sycode"> Input </p> <p class="sycode"> In the first line there is an integer T , indicates the number of test cases. <br> For each case, the first line contains two numbers N and M.The second line contains N integers, separated by space: a[1],a[2],...,a[n]?initial value of array elements. <br> Each of the next M lines begins with a character type. <br> If type==S,there will be two integers more in the line: X,Y. <br> If type==Q,there will be four integers more in the line: L R D P. <br> <br> [Technical Specification] <br> 1 1 0 1 0 1 1 0 </p> <p class="sycode"> </p> <br> <p class="sycode"> Output </p> <p class="sycode"> For each operation Q, output a line contains the answer. </p> <p class="sycode"> </p> <br> <p class="sycode"> Sample Input </p> <p class="sycode"> </p> <pre class="brush:php;toolbar:false"> <p class="sycode"> 15 710 11 12 13 14Q 1 5 2 1Q 1 5 1 0Q 1 5 1 1Q 1 5 3 0Q 1 5 3 1S 1 100Q 1 5 3 1 </p>
Sample Output
<p class="sycode"> 511501 </p>
Source
BestCoder Round #11 (Div. 2)
Recommend
heyang | We have carefully selected several similar problems for you: 5053 5052 5051 5050 5049
题意:
给你一个长度不超过1e5的数列。你可以进行两种操作。
1.S x y。把第x个数变成y。
2.Q l r d p 。询问[l,r]中数的第d个数字是p的有多少个。
思路:
看到这题。喜出望外。今天是可以ak的节奏啊。(不知道1002会挂。。--||)。感觉典型线段树的应用。每个节点一个数组val[rt][i][j]。表示节点代表的区间里第i个数字为j的有多少个。然后欢快的写完了。写完编译运行一次通过。无任何错误和警告测样例完全正确!然后愉快的交了。然后就mle了。。。当时就傻了。一看题目内存限制。晕。居然有数据结构题目卡内存的。然后想了下树状数组开1e7空间就算是short也超了,但是想到了离线处理每一位的修改和询问。但这时已经20:20。依稀的记得20:30就要开hack了。就放弃了挣扎了。后来醒悟后还是没时间改了。虽然正解有我说的离线处理。但是总觉得还是蛮麻烦的就用分块写了。就是分成sqrt(n)块。块内直接暴力。块间利用整块信息维护快速算出答案。时间复杂度O(n*sqrt(n))。写完一交居然rank1.估计O(10*n*log(n))的做法常数太大了。
详细见代码:
#include<algorithm>#include<iostream>#include<string.h>#include<stdio.h>#include<math.h>using namespace std;const int INF=0x3f3f3f3f;const int maxn=100003;typedef long long ll;#define lson L,mid,ls#define rson mid+1,R,rsint val[maxn][11],da[400][11][10],x;int main(){ int t,n,m,i,j,le,ri,d,p,x,y,bk,ans,st,ed,lim; char cmd[10]; scanf("%d",&t); while(t--) { scanf("%d%d",&n,&m); bk=ceil(sqrt(1.0*n)); memset(da,0,sizeof da); memset(val,0,sizeof val); for(i=1;i <br> <br> </math.h></stdio.h></string.h></iostream></algorithm>

핫 AI 도구

Undresser.AI Undress
사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover
사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool
무료로 이미지를 벗다

Clothoff.io
AI 옷 제거제

AI Hentai Generator
AI Hentai를 무료로 생성하십시오.

인기 기사

뜨거운 도구

메모장++7.3.1
사용하기 쉬운 무료 코드 편집기

SublimeText3 중국어 버전
중국어 버전, 사용하기 매우 쉽습니다.

스튜디오 13.0.1 보내기
강력한 PHP 통합 개발 환경

드림위버 CS6
시각적 웹 개발 도구

SublimeText3 Mac 버전
신 수준의 코드 편집 소프트웨어(SublimeText3)

뜨거운 주제











Go 언어에서는 컬렉션과 같은 기능을 구현하기가 어렵기 때문에 많은 개발자들이 고민하고 있습니다. Python이나 Java와 같은 다른 프로그래밍 언어와 비교할 때 Go 언어에는 집합, 맵 등과 같은 컬렉션 유형이 내장되어 있지 않아 개발자가 컬렉션 기능을 구현할 때 몇 가지 어려움을 겪습니다. 먼저 Go 언어에서 컬렉션과 유사한 기능을 직접 구현하는 것이 왜 어려운지 살펴보겠습니다. Go 언어에서 가장 일반적으로 사용되는 데이터 구조는 컬렉션과 유사한 기능을 완성할 수 있지만

Java는 다양한 유형의 소프트웨어 개발에 널리 사용되는 강력한 프로그래밍 언어입니다. Java 개발에는 종종 컬렉션 정렬과 관련된 시나리오가 포함됩니다. 그러나 컬렉션 정렬에 대한 성능 최적화를 수행하지 않으면 프로그램의 실행 효율성이 저하될 수 있습니다. 이 기사에서는 Java 컬렉션 정렬 성능을 최적화하는 방법을 살펴보겠습니다. 1. 적절한 컬렉션 클래스 선택 Java에는 ArrayList, LinkedList, TreeSet 등과 같이 정렬에 사용할 수 있는 컬렉션 클래스가 많이 있습니다. 다양한 컬렉션 클래스가 있습니다.

PHP에서 round는 "반올림"을 의미하며 부동 소수점 숫자를 정수로 변환하는 내장 함수입니다. 이 함수는 부동 소수점 숫자를 반올림하고 float 유형의 정수 값을 반환할 수 있습니다. 구문은 "round(number, Precision,mode)입니다. );".

round() 함수는 부동 소수점 숫자를 지정된 소수 자릿수로 반올림할 수 있는 PHP 숫자 형식 라이브러리의 매우 유용한 함수입니다. 그러나 PHP의 나눗셈 연산은 소수점이 무한하거나 정밀도가 손실될 수 있으므로 제수에 대한 반올림도 필요합니다. 다음으로 PHP의 round() 함수를 사용하여 나누기와 반올림하는 방법을 자세히 설명하겠습니다.

Laravel 컬렉션의 Where 메소드에 대한 실용 가이드 Laravel 프레임워크를 개발하는 동안 컬렉션은 데이터를 조작하기 위한 풍부한 메소드를 제공하는 매우 유용한 데이터 구조입니다. 그 중 Where 방식은 특정 조건에 따라 컬렉션의 요소를 필터링할 수 있는 일반적으로 사용되는 필터링 방식이다. 이 글에서는 Laravel 컬렉션에서 Where 메소드의 사용법을 소개하고 특정 코드 예제를 통해 사용법을 보여줍니다. 1. Where 메소드의 기본 사용법

HashSet 클래스의 addAll() 메소드를 사용하여 컬렉션의 모든 요소를 다른 컬렉션에 추가합니다. HashSet은 Java 컬렉션 프레임워크의 구현 클래스이며 Set 인터페이스를 구현합니다. HashSet은 해시 테이블을 기반으로 하는 순서가 지정되지 않은 집합으로 중복 요소를 허용하지 않습니다. 이는 컬렉션의 요소를 조작하기 위해 일반적으로 사용되는 여러 가지 메소드를 제공하며, 그 중 하나가 addAll() 메소드입니다. addAll() 메소드의 기능은 지정된 항목을 추가하는 것입니다.

C#의 일반적인 동시 컬렉션 및 스레드 안전 문제 C# 프로그래밍에서 동시 작업 처리는 매우 일반적인 요구 사항입니다. 여러 스레드가 동시에 동일한 데이터에 액세스하고 수정할 때 스레드 안전 문제가 발생합니다. 이 문제를 해결하기 위해 C#에서는 몇 가지 동시 수집 및 스레드 안전 메커니즘을 제공합니다. 이 문서에서는 C#의 일반적인 동시 컬렉션과 스레드 안전 문제를 처리하는 방법을 소개하고 구체적인 코드 예제를 제공합니다. 동시 수집 1.1ConcurrentDictionaryConcurrentDictio

Iterator 인터페이스 Iterator 인터페이스는 컬렉션을 순회하는 데 사용되는 인터페이스입니다. hasNext(), next() 및 Remove()를 포함한 여러 메소드를 제공합니다. hasNext() 메서드는 컬렉션에 다음 요소가 있는지 여부를 나타내는 부울 값을 반환합니다. next() 메서드는 컬렉션의 다음 요소를 반환하고 컬렉션에서 제거합니다. Remove() 메서드는 컬렉션에서 현재 요소를 제거합니다. 다음 코드 예제에서는 Iterator 인터페이스를 사용하여 컬렉션을 반복하는 방법을 보여줍니다. Listnames=Arrays.asList("John","Mary","Bob");Iterator
