Input212Sample OutputCase #1:2Case #2:19Source2014 ACM/ICPC Asia Regional Shanghai Online Problem Solving:Each m four edge, each edge at most with the original edge intersection, forming a n-1 intersection, is not related to Euler theorem?? Then the team-mates magically moved out F (n) =f (n-1) +4*4* (n-1) +1; then came out 8*n^2-7*n+1 ...Well, the point is that he used the formula directly with the C + + large number template T. So, I used the Java large number of classes handed a pitch, 1900m
* n/2 + 1-N * 9 = N * (8 * N-7) + 1
Because N is a maximum of 10 ^ 12 ,__ int64 (long) is 9*10 ^ 18, N * n will overflow data. If there is no computing time complexity at the beginning, a common big number operation is used, and the result times out. Later, the senior engineer said that the big data was optimized,
Is to divide a large number into two parts, respectively, with _ int64.
To prevent the overflow of the two-digit multiplication data, the right half of my number is nine digits. For e
Question link: http://acm.hdu.edu.cn/showproblem.php? PID = 1, 5047
Problem descriptionthink about a plane:
● One straight line can divide a plane into two regions.
● Two lines can divide a plane into at most four regions.
● Three lines can divide a plane into at most seven regions.
● And so on...
Now we have some figure constructed with two parallel rays in the same direction, joined by two straight segments. it looks like a character "M ". you are given n such "M" S. what is the maximum num
Question: Find n 'M'-type broken lines to divide a plane into the largest number of faces!Idea: we all know that n straight lines divide a plane into a maximum number of planes: An = An-1 + n + 1That is, F (n) = (N * n + 2)/2What about a line of 'M' type? It has four lines, but the plane is divided due to the relationship between the three vertices.The number is reduced by 9! So there is a recursive formula F (n) = (M * m + 2)/2-9 * n; M = 4 * n Finally, F (n) = (8 * n + 1) * (n-1) + 2)Since n
Question link: http://acm.hdu.edu.cn/showproblem.php? PID = 1, 5047
Solution Report: Ask a "M" type to divide the plane of a rectangle into a maximum of several blocks.
The input has n "M". Now the formula is 8 * n ^ 2-7 * n + 1, but the range of N is 10 ^ 12, as long as the square is within the range of long, what should we do with a large number?
I 've tried it all. It's strange that it will time out. I don't think it will happen according to estimation. Maybe it's because the intermediate res
Hdu 5047 Sawtooth combined mathematical precision, hdusawtooth
Question link: Click the open link
Question: omitted
Train of Thought: transfer the card .. I don't want to talk much about it. I mainly want to record the fast reading and writing of java to prevent such bad questions from coming into being next time.
Cpp version:
#include
Java version:
import java.util.*;import java.io.*;import java.math.*;public class test {public static void main
ZOJ 3814 Sawtooth Puzzle status compression search, zoj3814
Since there are only four statuses in a box, the total number of statuses is only 4 ^ 9, and bfs can be solved.
The trouble lies in simulation.
The method of saving my status is to regard the initial status as 000000000. If it is rotated once clockwise, + 1, 3 + 1 = 0.
During the bfs process, you need to set a dfs calculation to which boxes will be affected by rotating the current box.
Note t
Last two articlesArticleNeither of the methods described can be the best way to implement the anti-sawtooth font. Let's see how the master did it.
Fr é d é Ric Lavigne, author of the famous skin L F and webmaster of www.javootoo.com, a great repository of look and feels for swing, didn't think so and found an elegant and clever way to get the same result
Okay, for simplicity, jar package
Http://download.csdn.net/detail/laizhenhai88/5094403
As lon
Since there are only four statuses in a box, the total number of statuses is only 4 ^ 9, and BFS can be solved.
The trouble lies in simulation.
The method of saving my status is to regard the initial status as 000000000. If it is rotated once clockwise, + 1, 3 + 1 = 0.
During the BFS process, you need to set a DFS calculation to which boxes will be affected by rotating the current box.
Note that there are more than one target status, because some boxes remain unchanged after rotation, we must ca
The Win7 system plays the video movie to appear Sawtooth, mosaic, blur how to do?
1, click "Start-Control Panel-system-Advanced system settings;"
2. In the Pop-up System Properties dialog box, switch to the Advanced tab and click Settings in the Performance area.
3, in the pop-up "Visual Effects" tab, click "Custom", will "enable desktop combination" before the check to remove;
4, after the modification, save the settings to e
relatively troublesome, need to pass some xxxx.parsexxx (), to convert the corresponding data type, although, some trouble, but by comparing on some OJ systems and scanner, Bufferreader efficiency is one times higher than scanner, this gap can be imagined, read more data, the effect is more obvious.AC ProgramImport Java.io.*;import java.math.*;p ublic class main{public static BufferedReader cin=new BufferedReader (new InputStreamReader (system.in)); public static BufferedWriter cout=new Buffe
Introduction
Based on the generation of images to achieve a mobile phone number of the need to turn pictures. Content is also very simple, directly using mobile phone number to generate a PNG image. is for the background to be transparent so that other places are invoked. There is no sawtooth mainly relies on a code: G. Textrenderinghint= Textrenderinghint.antialias;
Generate pictures
1, serrated
2, no Sawto
Test instructionsUse x large m to divide a plane into several blocks.is the enhanced version of the polyline cut plane.A simple recursive formula: F (x+1) = 16x+1+f (x)Then turn it into a pass-through formula, and then C + + bit-press the large number simulation#include HDU 5047 Sawtooth Law + C + + large number simulation ACM/ICPC Asia regional Shanghai Online
My personal understanding is as follows:
Technology:I understand it as a general technology, such as forums, blogs, and portals. They can be used wherever they are needed, and may only need a few modifications.Professional Technology:Such as finance, manpower, production arrangement, ERP, and sales management. You are familiar with a major. For example, Kingdee and yonyou are financial software providers.Industry Technology:Such as GSP software for sale in the pharmaceutical industry, Word Se
With the rapid development of the Internet, communication technology is experiencing a huge revolution, because the number of users accessing the network rapidly increases. As a network connected to the end users in the communication network, the access network has become a hot topic in network technology.
Currently, the main access technologies include hybrid fiber/coaxial (HFCs) access technology, optical fiber access technology, copper wire access
13 core technologies of J2EE and J2EE13 core technologies
I. JDBC (Java Database Connectivity)
JDBC APIs provide a unified way to access different databases. Like ODBC, JDBC shields developers from some details. In addition, JDBC access to databases is also platform-independent.
II,JNDI (Java Name and Directory Interface)
The jndi api is used to run the name and directory services. It provides a consistent
What technologies are commonly used for php large websites? How can these technologies be combined with one piece of cdn mysql deployment, memcached, and redis?
Reply to discussion (solution)
Baidu's "PHP development and learning portal" is included
At first, you can get an understanding of whether you can use the company and project that you are working on. Generally, you can use it as an interest
(Switch) 13 core technologies of J2EE and j2ee13 core technologies
I. JDBC (Java Database Connectivity)
JDBC APIs provide a unified way to access different databases. Like ODBC, JDBC shields developers from some details. In addition, JDBC access to databases is also platform-independent.
Ii. JNDI (Java Name and Directory Interface)
The jndi api is used to run the name and directory services. It provides a c
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.