search
HomeWeb Front-endHTML TutorialThe 20th codeforces competition ends #276 Div 2_html/css_WEB-ITnose


It was a CF that was full of situations...

It was finally Unrated, how can you let us who had CF in the middle of the night feel relieved (there were so many people on the way) They all left the game)...Although I didn’t play well...

Write a problem-solving report for this codeforces game here, including questions from A-E and AC codes. Some questions have simple analysis, and the code is quite clear. , the main reading code should not be difficult to understand.

Questions about problems

# Author Problem When Question Answer General announcement ***** This round will be unrated due to technical issues. Duration will be extended by 30 minutes. Testing queue is really long. Continue solving other problems. We are sorry for an inconvenience .
2014-11-05 21 :24:38 Announcement General announcement # Author Problem When Question Answer
      2014-11-05 21:24:38 Announcement General announcement
*****
Issue of problem locking was fixed. Now you should be able to lock task if you passed pretests.
      2014-11-05 21:18:46 Announcement General announcement
*****
You may be unable to lock some problems for hacking. This will be fixed soon.
      2014-11-05 20:23:29 Announcement General announcement
*****
This round will be unrated due to technical issues. Duration will be extended by 30 minutes. Testing queue is really long. Continue solving other problems. We are sorry for an inconvenience.

***** Issue of problem locking was fixed. Now you should be able to lock task if you passed pretests.
2014-11-05 21:18:46 Announcement General announcement ***** You may be unable to lock some problems for hacking. This will be fixed soon.
2014-11-05 20:23:29 Announcement

A. Factory

time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to produce  (remainder after dividing x by m) more details. Unfortunately, no customer has ever bought any mythical detail, so all the details produced stay on the factory.

The board of directors are worried that the production by the given plan may eventually stop (that means that there will be а moment when the current number of details on the factory is divisible by m).

Given the number of details a on the first day and number m check if the production stops at some moment.

Input

The first line contains two integers a and m (1?≤?a,?m?≤?105).

Output

Print "Yes" (without quotes) if the production will eventually stop, otherwise print "No".

Sample test(s)

input

1 5

output

No

input

3 6

output

Yes


给两个数字a和m,工厂每次看a是多少就生产a个东西,然后把a变为a%m,如果a为0工序就崩盘了,问是否会崩盘

那就用大小为m的一个vis数组来记录当前余数是否被用过,然后模拟,每次记录当前余数,如果余数变成0了输出Yes,如果余数到达了曾经有过的余数位置,那么就会以此为一个循环永远循环下去,那么我们break,输出No

Code:

#include <cmath> #include <cctype>#include <cstdio>#include <string>#include <cstdlib>#include <cstring>#include <iostream>#include <algorithm>using namespace std;#define Max(a,b) ((a)>(b)?(a):(b))#define Min(a,b) ((a)>a>>m;	int vis[100086]={0};	while(1)	{		if(a==0){cout  <br>  <p></p>  <p class="sycode">   </p>
<p class="sycode">    </p>
<p class="sycode">     </p>
<p class="sycode">      </p>
<p class="sycode">       </p>
<p class="sycode">        </p>
<h2 id="B-Valuable-Resources">B. Valuable Resources</h2>        <p class="sycode">         </p>
<p class="sycode">          time limit per test         </p> 1 second                <p class="sycode">         </p>
<p class="sycode">          memory limit per test         </p> 256 megabytes                <p class="sycode">         </p>
<p class="sycode">          input         </p> standard input                <p class="sycode">         </p>
<p class="sycode">          output         </p> standard output                      <p class="sycode">        </p>
<p> Many computer strategy games require building cities, recruiting army, conquering tribes, collecting resources. Sometimes it leads to interesting problems.</p>        <p> Let's suppose that your task is to build a square city. The world map uses the Cartesian coordinates. The sides of the city should be parallel to coordinate axes. The map contains mines with valuable resources, located at some points with integer coordinates. The sizes of mines are relatively small, i.e. they can be treated as points. The city should be built in such a way that all the mines are inside or on the border of the city square.</p>        <p> Building a city takes large amount of money depending on the size of the city, so you have to build the city with the minimum area. Given the positions of the mines find the minimum possible area of the city.</p>              <p class="sycode">        </p>
<p class="sycode">         Input        </p>        <p> The first line of the input contains number n ? the number of mines on the map (2?≤?n?≤?1000). Each of the next n lines contains a pair of integers xi and yi ? the coordinates of the corresponding mine (?-?109?≤?xi,?yi?≤?109). All points are pairwise distinct.</p>              <p class="sycode">        </p>
<p class="sycode">         Output        </p>        <p> Print the minimum area of the city that can cover all the mines with valuable resources.</p>              <p class="sycode">        </p>
<p class="sycode">         Sample test(s)        </p>        <p class="sycode">         </p>
<p class="sycode">          </p>
<p class="sycode">           input          </p>          <pre style="代码" class="precsshei">20 02 2

output

input

20 00 3

output


有一个城市需要建造,给你许多矿坑d坐标点,问把这么多矿坑全都包进城市的话,城市所需最小面积是多少(注意,城市为平行于坐标轴的正方形)

这不知道算不算凸包,反正记录最大最小的x和y,然后相减获得最小矩形长宽,取两者较长边平方即可。

Code:

#include <cmath> #include <cctype>#include <cstdio>#include <string>#include <cstdlib>#include <cstring>#include <iostream>#include <algorithm>using namespace std;const int inf=(int)1e9+10086;#define Max(a,b) ((a)>(b)?(a):(b))#define Min(a,b) ((a) b;}int main(){	int n;	cin>>n;	int up=-inf,down=inf,left=inf,right=-inf;	for(int i=0;i<n int x cin>>x>>y;		if(x<left left="x;" if>right)	right=x;		if(y<down down="y;" if>up)	up=y;	}	int len=max(up-down,right-left);	cout  <br>  <p></p>  <p class="sycode">   </p>
<p class="sycode">    </p>
<p class="sycode">     </p>
<p class="sycode">      </p>
<p class="sycode">       </p>
<p class="sycode">        </p>
<h2 id="C-Bits">C. Bits</h2>        <p class="sycode">         </p>
<p class="sycode">          time limit per test         </p> 1 second                <p class="sycode">         </p>
<p class="sycode">          memory limit per test         </p> 256 megabytes                <p class="sycode">         </p>
<p class="sycode">          input         </p> standard input                <p class="sycode">         </p>
<p class="sycode">          output         </p> standard output                      <p class="sycode">        </p>
<p> Let's denote as  the number of bits set ('1' bits) in the binary representation of the non-negative integer x.</p>        <p> You are given multiple queries consisting of pairs of integers l and r. For each query, find the x, such that l?≤?x?≤?r, and is maximum possible. If there are multiple such numbers find the smallest of them.</p>              <p class="sycode">        </p>
<p class="sycode">         Input        </p>        <p> The first line contains integer n ? the number of queries (1?≤?n?≤?10000).</p>        <p> Each of the following n lines contain two integers li,?ri ? the arguments for the corresponding query (0?≤?li?≤?ri?≤?1018).</p>              <p class="sycode">        </p>
<p class="sycode">         Output        </p>        <p> For each query print the answer in a separate line.</p>              <p class="sycode">        </p>
<p class="sycode">         Sample test(s)        </p>        <p class="sycode">         </p>
<p class="sycode">          </p>
<p class="sycode">           input          </p>          <pre style="代码" class="precsshei">31 22 41 10

output

137

Note

The binary representations of numbers from 1 to 10 are listed below:

110?=?12

210?=?102

310?=?112

410?=?1002

510?=?1012

610?=?1102

710?=?1112

810?=?10002

910?=?10012

1010?=?10102



这题是给一个范围(L是左边界,R是有边界)问你在这个范围内哪个数载二进制下1的数量是最多的(有多个解请输出最小数)。

也就是,要二进制的1尽量多,还要求尽量小,那就从低位开始把0变成1呗

那么我们就从左边界开始,从低位向高位按位或(0变成1,1也还是1)1,直到比R大停止,输出前一个(即比R小的最后一个数)。

Code:

#include <cmath> #include <cctype>#include <cstdio>#include <string>#include <cstdlib>#include <cstring>#include <iostream>#include <algorithm>using namespace std;typedef long long ll;#define Max(a,b) ((a)>(b)?(a):(b))#define Min(a,b) ((a)>l>>r;		for(ll i=0;ir)break;			l=t,p  <br>  <p></p>  <p class="sycode">   </p>
<p class="sycode">    </p>
<p class="sycode">     </p>
<p class="sycode">      </p>
<p class="sycode">       </p>
<p class="sycode">        </p>
<h2 id="D-Maximum-Value">D. Maximum Value</h2>        <p class="sycode">         </p>
<p class="sycode">          time limit per test         </p> 1 second                <p class="sycode">         </p>
<p class="sycode">          memory limit per test         </p> 256 megabytes                <p class="sycode">         </p>
<p class="sycode">          input         </p> standard input                <p class="sycode">         </p>
<p class="sycode">          output         </p> standard output                      <p class="sycode">        </p>
<p> You are given a sequence a consisting of n integers. Find the maximum possible value of  (integer remainder of ai divided byaj), where 1?≤?i,?j?≤?n and ai?≥?aj.</p>              <p class="sycode">        </p>
<p class="sycode">         Input        </p>        <p> The first line contains integer n ? the length of the sequence (1?≤?n?≤?2·105).</p>        <p> The second line contains n space-separated integers ai (1?≤?ai?≤?106).</p>              <p class="sycode">        </p>
<p class="sycode">         Output        </p>        <p> Print the answer to the problem.</p>              <p class="sycode">        </p>
<p class="sycode">         Sample test(s)        </p>        <p class="sycode">         </p>
<p class="sycode">          </p>
<p class="sycode">           input          </p>          <pre style="代码" class="precsshei">33 4 5

output


短小精悍却烦人至深的题,我原先想的太简单了,写了个

	int n=0;	cin>>n;	for(int i=0;i<n scanf sort int modmax="0;" for i="0;" num>modmax; i++)		for(int j=i+1;num[j]>modmax && j<n j update num cout return>这样的东西……TLE的飞起……  <p></p>  <p>想了想就不能暴力啊,暴力的话剪枝也没用</p>  <h3 id="Code">Code:</h3>  <p></p>  <pre name="code" class="sycode">#include <cmath> #include <cctype>#include <cstdio>#include <string>#include <cstdlib>#include <cstring>#include <iostream>#include <algorithm>using namespace std;int n,a[200048]={0},ans=0;#define Max(a,b) ((a)>(b)?(a):(b))#define Min(a,b) ((a) 0) update(a[p-1] % a[i]);			j+=a[i];		}		update(a[n-1] % a[i]); 	}	printf("%d\n",ans);	return 0;}</algorithm></iostream></cstring></cstdlib></string></cstdio></cctype></cmath>

E. Strange Sorting

time limit per test

2 seconds

memory limit per test

256 megabytes

input

standard input

output

standard output

How many specific orders do you know? Ascending order, descending order, order of ascending length, order of ascending polar angle... Let's have a look at another specific order: d-sorting. This sorting is applied to the strings of length at least d, where d is some positive integer. The characters of the string are sorted in following manner: first come all the 0-th characters of the initial string, then the 1-st ones, then the 2-nd ones and so on, in the end go all the (d?-?1)-th characters of the initial string. By the i-th characters we mean all the character whose positions are exactly i modulo d. If two characters stand on the positions with the same remainder of integer division byd, their relative order after the sorting shouldn't be changed. The string is zero-indexed. For example, for string 'qwerty':

Its 1-sorting is the string 'qwerty' (all characters stand on 0 positions),

Its 2-sorting is the string 'qetwry' (characters 'q', 'e' and 't' stand on 0 positions and characters 'w', 'r' and 'y' are on 1 positions),

Its 3-sorting is the string 'qrwtey' (characters 'q' and 'r' stand on 0 positions, characters 'w' and 't' stand on 1 positions and characters 'e' and 'y' stand on 2 positions),

Its 4-sorting is the string 'qtwyer',

Its 5-sorting is the string 'qywert'.

You are given string S of length n and m shuffling operations of this string. Each shuffling operation accepts two integer arguments kand d and transforms string S as follows. For each i from 0 to n?-?k in the increasing order we apply the operation of d-sorting to the substring S[i..i?+?k?-?1]. Here S[a..b] represents a substring that consists of characters on positions from a to b inclusive.

After each shuffling operation you need to print string S.

Input

The first line of the input contains a non-empty string S of length n, consisting of lowercase and uppercase English letters and digits from 0 to 9.

The second line of the input contains integer m ? the number of shuffling operations (1?≤?m·n?≤?106).

Following m lines contain the descriptions of the operations consisting of two integers k and d (1?≤?d?≤?k?≤?n).

Output

After each operation print the current state of string S.

Sample test(s)

input

qwerty34 26 35 2

output

qertwyqtewryqetyrw

Note

Here is detailed explanation of the sample. The first modification is executed with arguments k?=?4, d?=?2. That means that you need to apply 2-sorting for each substring of length 4 one by one moving from the left to the right. The string will transform in the following manner:

qwerty ?→? qewrty ?→? qerwty ?→? qertwy

Thus, string S equals 'qertwy' at the end of first query.

The second modification is executed with arguments k?=?6, d?=?3. As a result of this operation the whole string S is replaced by its 3-sorting:

qertwy ?→? qtewry

The third modification is executed with arguments k?=?5, d?=?2.

qtewry ?→? qertwy ?→? qetyrw


给一串字符串,每次给两个数字k和d,即要求从左到右每k个数进行一次 d-sorting,这种sorting的意思是,每d个数字选一个,这么分好组之后排序,详见hint

DIV2全场只有一个人(joker99)出了E,看了下代码暂时囫囵吞了下,贴一下代码等日后学习下。

Code:

#include <cmath> #include <cctype>#include <cstdio>#include <string>#include <cstdlib>#include <cstring>#include <iostream>#include <algorithm>using namespace std;#define Max(a,b) ((a)>(b)?(a):(b))#define Min(a,b) ((a)= 0; h--)                if (vl >= (1 = sh)	ps = pwr[h][ps - sh] + sh;                    vl -= (1   <br>  <br>  <p></p>  <p><br> </p>  <p><br> </p>  <p><br> </p>  <p><br> </p>  <p><br> </p>  <p><br> </p>  <p><br> </p>  <p><br> </p>  <p><br> </p>  <p><br> </p>  <p><br> </p> </algorithm></iostream></cstring></cstdlib></string></cstdio></cctype></cmath>
Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
The Future of HTML: Evolution and Trends in Web DesignThe Future of HTML: Evolution and Trends in Web DesignApr 17, 2025 am 12:12 AM

The future of HTML is full of infinite possibilities. 1) New features and standards will include more semantic tags and the popularity of WebComponents. 2) The web design trend will continue to develop towards responsive and accessible design. 3) Performance optimization will improve the user experience through responsive image loading and lazy loading technologies.

HTML vs. CSS vs. JavaScript: A Comparative OverviewHTML vs. CSS vs. JavaScript: A Comparative OverviewApr 16, 2025 am 12:04 AM

The roles of HTML, CSS and JavaScript in web development are: HTML is responsible for content structure, CSS is responsible for style, and JavaScript is responsible for dynamic behavior. 1. HTML defines the web page structure and content through tags to ensure semantics. 2. CSS controls the web page style through selectors and attributes to make it beautiful and easy to read. 3. JavaScript controls web page behavior through scripts to achieve dynamic and interactive functions.

HTML: Is It a Programming Language or Something Else?HTML: Is It a Programming Language or Something Else?Apr 15, 2025 am 12:13 AM

HTMLisnotaprogramminglanguage;itisamarkuplanguage.1)HTMLstructuresandformatswebcontentusingtags.2)ItworkswithCSSforstylingandJavaScriptforinteractivity,enhancingwebdevelopment.

HTML: Building the Structure of Web PagesHTML: Building the Structure of Web PagesApr 14, 2025 am 12:14 AM

HTML is the cornerstone of building web page structure. 1. HTML defines the content structure and semantics, and uses, etc. tags. 2. Provide semantic markers, such as, etc., to improve SEO effect. 3. To realize user interaction through tags, pay attention to form verification. 4. Use advanced elements such as, combined with JavaScript to achieve dynamic effects. 5. Common errors include unclosed labels and unquoted attribute values, and verification tools are required. 6. Optimization strategies include reducing HTTP requests, compressing HTML, using semantic tags, etc.

From Text to Websites: The Power of HTMLFrom Text to Websites: The Power of HTMLApr 13, 2025 am 12:07 AM

HTML is a language used to build web pages, defining web page structure and content through tags and attributes. 1) HTML organizes document structure through tags, such as,. 2) The browser parses HTML to build the DOM and renders the web page. 3) New features of HTML5, such as, enhance multimedia functions. 4) Common errors include unclosed labels and unquoted attribute values. 5) Optimization suggestions include using semantic tags and reducing file size.

Understanding HTML, CSS, and JavaScript: A Beginner's GuideUnderstanding HTML, CSS, and JavaScript: A Beginner's GuideApr 12, 2025 am 12:02 AM

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

The Role of HTML: Structuring Web ContentThe Role of HTML: Structuring Web ContentApr 11, 2025 am 12:12 AM

The role of HTML is to define the structure and content of a web page through tags and attributes. 1. HTML organizes content through tags such as , making it easy to read and understand. 2. Use semantic tags such as, etc. to enhance accessibility and SEO. 3. Optimizing HTML code can improve web page loading speed and user experience.

HTML and Code: A Closer Look at the TerminologyHTML and Code: A Closer Look at the TerminologyApr 10, 2025 am 09:28 AM

HTMLisaspecifictypeofcodefocusedonstructuringwebcontent,while"code"broadlyincludeslanguageslikeJavaScriptandPythonforfunctionality.1)HTMLdefineswebpagestructureusingtags.2)"Code"encompassesawiderrangeoflanguagesforlogicandinteract

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools