2 shunfurh shunfurh 于 2017.09.01 09:31 提问

Electricity

Blackouts and Dark Nights (also known as ACM++) is a company that provides electricity. The company owns several power plants, each of them supplying a small area that surrounds it. This organization brings a lot of problems - it often happens that there is not enough power in one area, while there is a large surplus in the rest of the country.

ACM++ has therefore decided to connect the networks of some of the plants together. At least in the first stage, there is no need to connect all plants to a single network, but on the other hand it may pay up to create redundant connections on critical places - i.e. the network may contain cycles. Various plans for the connections were proposed, and the complicated phase of evaluation of them has begun.

One of the criteria that has to be taken into account is the reliability of the created network. To evaluate it, we assume that the worst event that can happen is a malfunction in one of the joining points at the power plants, which might cause the network to split into several parts. While each of these parts could still work, each of them would have to cope with the problems, so it is essential to minimize the number of parts into which the network will split due to removal of one of the joining points.

Your task is to write a software that would help evaluating this risk. Your program is given a description of the network, and it should determine the maximum number of non-connected parts from that the network may consist after removal of one of the joining points (not counting the removed joining point itself).

Input

The input consists of several instances.

The first line of each instance contains two integers 1 <= P <= 10 000 and C >= 0 separated by a single space. P is the number of power plants. The power plants have assigned integers between 0 and P - 1. C is the number of connections. The following C lines of the instance describe the connections. Each of the lines contains two integers 0 <= p1, p2 < P separated by a single space, meaning that plants with numbers p1 and p2 are connected. Each connection is described exactly once and there is at most one connection between every two plants.

The instances follow each other immediately, without any separator. The input is terminated by a line containing two zeros.

Output

The output consists of several lines. The i-th line of the output corresponds to the i-th input instance. Each line of the output consists of a single integer C. C is the maximum number of the connected parts of the network that can be obtained by removing one of the joining points at power plants in the instance.

Sample Input

3 3
0 1
0 2
2 1
4 2
0 1
2 3
3 1
1 0
0 0
Sample Output

1
2
2

1个回答

caozhy
caozhy   Ds   Rxr 2017.09.16 23:52
已采纳
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!
其他相关推荐
Introduction to deep learning第一周测验
Introduction to deep learning 第一周测验, 10 个问题 第 1 个问题 What does the analogy “AI is the new electricity” refer to? (B) A. AI is powering personal devices in our homes and offices, similar to electr...
神经网络与深度学习(3)
0.写在前面下面到了我们的神经网络与深度学习课程的作业环节了,由于在国内,所以有很多图片加载不出来,我只能臆想了。(这种简单的还好说,等到后面难的部分,我可想不出来。)1.习题1What does the analogy “AI is the new electricity” refer to?A. AI is powering personal devices in our homes and o
electricity and magnetism
1 Electricity and the Atom 13<br>2 The Nucleus 41<br>3 Circuits, Part 1 77<br>4 Circuits, Part 2 107<br>5 Fields of Force 123<br>6 Electromagnetism 143<br>A Capacitance and Inductance 169
4.electricity_and_magnetism_crowell 4.electricity_and_magnetism_crowell.pdf
4.electricity_and_magnetism_crowell.pdf4.electricity_and_magnetism_crowell.pdf4.electricity_and_magnetism_crowell.pdf
Teach Yourself Electricity & Electronics
Teach Yourself Electricity & Electronics<br><br>Part 1 Direct current<br>1 Basic physical concepts 3<br>Atoms 3<br>Protons, neutrons, and the atomic number 4<br>Isotopes and atomic weights 4<br>Electrons 5<br>Ions 5<br>Compounds 9<br>Molecules 10<br>Conductors 11<br>Insulators 11<br>Resistors 13<br>Semiconductors 14<br>Current 15<br>Static electricity 15<br>Electromotive force 16<br>Nonelectrical energy 18<br>Quiz 19<br>2 Electrical units 23<br>The volt 23<br>Current flow 24<br>The ampere 26<br>Resistance and the ohm 26<br>Conductance and the siemens 28<br>vii<br><br>viii Contents<br>Power and the watt 29<br>Energy and the watt hour 31<br>Other energy units 33<br>ac Waves and the hertz 34<br>Rectification and fluctuating direct current 35<br>Safety considerations in electrical work 37<br>Magnetism 38<br>Magnetic units 39<br>Quiz 40<br>3 Measuring devices 44<br>Electromagnetic deflection 44<br>Electrostatic deflection 46<br>Thermal heating 47<br>Ammeters 48<br>Voltmeters 49<br>Ohmmeters 51<br>Multimeters 53<br>FET and vacuum-tube voltmeters 54<br>Wattmeters 54<br>Watt-hour meters 55<br>Digital readout meters 56<br>Frequency counters 57<br>Other specialized meter types 57<br>Quiz 60<br>4 Basic dc circuits 65<br>Schematic symbols 65<br>Schematic diagrams 67<br>Wiring diagrams 68<br>Voltage/current/resistance circuit 68<br>Ohm’s Law 69<br>Current calculations 69<br>Voltage calculations 71<br>Resistance calculations 71<br>Power calculations 72<br>Resistances in series 73<br>Resistances in parallel 74<br>Division of power 75<br>Resistances in series-parallel 75<br>Resistive loads in general 77<br>Quiz 77<br>5 Direct-current circuit analysis 82<br>Current through series resistances 82<br>Voltages across series resistances 83<br><br>Contents ix<br>Voltage across parallel resistances 85<br>Currents through parallel resistances 86<br>Power distribution in series circuits 88<br>Power distribution in parallel circuits 88<br>Kirchhoff’s first law 89<br>Kirchhoff’s second law 91<br>Voltage divider networks 92<br>Quiz 95<br>6 Resistors 99<br>Purpose of the resistor 99<br>The carbon-composition resistor 102<br>The wirewound resistor 103<br>Film type resistors 104<br>Integrated-circuit resistors 104<br>The potentiometer 105<br>The decibel 107<br>The rheostat 109<br>Resistor values 110<br>Tolerance 110<br>Power rating 110<br>Temperature compensation 111<br>The color code 112<br>Quiz 114<br>7 Cells and batteries 118<br>Kinetic and potential energy 118<br>Electrochemical energy 118<br>Primary and secondary cells 119<br>The Weston standard cell 120<br>Storage capacity 120<br>Common dime-store cells and batteries 122<br>Miniature cells and batteries 124<br>Lead-acid cells and batteries 125<br>Nickel-cadmium cells and batteries 125<br>Photovoltaic cells and batteries 127<br>How large a battery? 128<br>Quiz 130<br>8 Magnetism 134<br>The geomagnetic field 134<br>Magnetic force 135<br>Electric charge in motion 136<br>Flux lines 136<br>Magnetic polarity 137<br>Dipoles and monopoles 139<br><br>x Contents<br>Magnetic field strength 139<br>Permeability 142<br>Retentivity 142<br>Permanent magnets 143<br>The solenoid 144<br>The dc motor 145<br>Magnetic data storage 146<br>Quiz 149<br>Test: Part 1 153<br>Part 2 Alternating current<br>9 Alternating current basics 165<br>Definition of alternating current 165<br>Period and frequency 165<br>The sine wave 167<br>The square wave 167<br>Sawtooth waves 167<br>Complex and irregular waveforms 169<br>Frequency spectrum 170<br>Little bits of a cycle 172<br>Phase difference 173<br>Amplitude of alternating current 173<br>Superimposed direct current 175<br>The ac generator 176<br>Why ac? 178<br>Quiz 178<br>10 Inductance 183<br>The property of inductance 183<br>Practical inductors 184<br>The unit of inductance 185<br>Inductors in series 185<br>Inductors in parallel 186<br>Interaction among inductors 187<br>Effects of mutual inductance 188<br>Air-core coils 189<br>Powdered-iron and ferrite cores 190<br>Permeability tuning 190<br>Toroids 190<br>Pot cores 192<br>Filter chokes 192<br>Inductors at audio frequency 193<br>Inductors at radio frequency 193<br>Transmission-line inductors 193<br><br>Contents xi<br>Unwanted inductances 195<br>Quiz 195<br>11 Capacitance 199<br>The property of capacitance 199<br>Practical capacitors 201<br>The unit of capacitance 201<br>Capacitors in series 202<br>Capacitors in parallel 203<br>Dielectric materials 204<br>Paper capacitors 204<br>Mica capacitors 205<br>Ceramic capacitors 205<br>Plastic-film capacitors 206<br>Electrolytic capcitors 206<br>Tantalum capacitors 206<br>Semiconductor capacitors 207<br>Variable capacitors 207<br>Tolerance 209<br>Temperature coefficient 210<br>Interelectrode capacitance 210<br>Quiz 211<br>12 Phase 215<br>Instantaneous voltage and current 215<br>Rate of change 216<br>Sine waves as circular motion 217<br>Degrees of phase 218<br>Radians of phase 221<br>Phase coincidence 221<br>Phase opposition 222<br>Leading phase 222<br>Lagging phase 224<br>Vector diagrams of phase relationships 225<br>Quiz 226<br>13 Inductive reactance 231<br>Coils and direct current 231<br>Coils and alternating current 232<br>Reactance and frequency 233<br>Points in the RL plane 234<br>Vectors in the RL plane 235<br>Current lags voltage 237<br>Inductance and resistance 238<br>How much lag? 240<br>Quiz 243<br><br>xii Contents<br>14 Capacitive reactance 247<br>Capacitors and direct current 247<br>Capacitors and alternating current 248<br>Reactance and frequency 249<br>Points in the RC plane 251<br>Vectors in the RC plane 253<br>Current leads voltage 254<br>How much lead? 256<br>Quiz 259<br>15 Impedance and admittance 264<br>Imaginary numbers 264<br>Complex numbers 265<br>The complex number plane 266<br>The RX plane 269<br>Vector representation of impedance 270<br>Absolute-value impedance 272<br>Characteristic impedance 272<br>Conductance 275<br>Susceptance 275<br>Admittance 276<br>The GB plane 277<br>Vector representation of admittance 279<br>Why all these different expressions? 279<br>Quiz 280<br>16 RLC circuit analysis 284<br>Complex impedances in series 284<br>Series RLC circuits 288<br>Complex admittances in parallel 289<br>Parallel GLC circuits 292<br>Converting from admittance to impedance 294<br>Putting it all together 294<br>Reducing complicated RLC circuits 295<br>Ohm’s law for ac circuits 298<br>Quiz 301<br>17 Power and resonance in ac circuits 305<br>What is power? 305<br>True power doesn’t travel 307<br>Reactance does not consume power 308<br>True power, VA power and reactive power 309<br>Power factor 310<br>Calculation of power factor 310<br>How much of the power is true? 313<br><br>Contents xiii<br>Power transmission 315<br>Series resonance 318<br>Parallel resonance 319<br>Calculating resonant frequency 319<br>Resonant devices 321<br>Quiz 323<br>18 Transformers and impedance matching 327<br>Principle of the transformer 327<br>Turns ratio 328<br>Transformer cores 329<br>Transformer geometry 330<br>The autotransformer 333<br>Power transformers 334<br>Audio-frequency transformers 336<br>Isolation transformers 336<br>Impedance-transfer ratio 338<br>Radio-frequency transformers 339<br>What about reactance? 341<br>Quiz 342<br>Test: Part 2 346<br>Part 3 Basic electronics<br>19 Introduction to semiconductors 359<br>The semiconductor revolution 359<br>Semiconductor materials 360<br>Doping 362<br>Majority and minority charge carriers 362<br>Electron flow 362<br>Hole flow 363<br>Behavior of a P-N junction 363<br>How the junction works 364<br>Junction capacitance 366<br>Avalanche effect 366<br>Quiz 367<br>20 Some uses of diodes 370<br>Rectification 370<br>Detection 371<br>Frequency multiplication 372<br>Mixing 373<br>Switching 374<br>Voltage regulation 374<br>Amplitude limiting 374<br><br>xiv Contents<br>Frequency control 376<br>Oscillation and amplification 377<br>Energy emission 377<br>Photosensitive diodes 378<br>Quiz 380<br>21 Power supplies 383<br>Parts of a power supply 383<br>The power transformer 384<br>The diode 385<br>The half-wave rectifier 386<br>The full-wave, center-tap rectifier 387<br>The bridge rectifier 387<br>The voltage doubler 389<br>The filter 390<br>Voltage regulation 392<br>Surge current 393<br>Transient suppression 394<br>Fuses and breakers 394<br>Personal safety 395<br>Quiz 396<br>22 The bipolar transistor 400<br>NPN versus PNP 400<br>NPN biasing 402<br>PNP biasing 404<br>Biasing for current amplification 404<br>Static current amplification 405<br>Dynamic current amplification 406<br>Overdrive 406<br>Gain versus frequency 407<br>Common-emitter circuit 408<br>Common-base circuit 409<br>Common-collector circuit 410<br>Quiz 411<br>23 The field-effect transistor 416<br>Principle of the JFET 416<br>N-channel versus P-channel 417<br>Depletion and pinchoff 418<br>JFET biasing 419<br>Voltage amplification 420<br>Drain current versus drain voltage 421<br>Transconductance 422<br>The MOSFET 422<br><br>Contents xv<br>Depletion mode versus enhancement mode 425<br>Common-source circuit 425<br>Common-gate circuit 426<br>Common-drain circuit 427<br>A note about notation 429<br>Quiz 429<br>24 Amplifiers 433<br>The decibel 433<br>Basic bipolar amplifier circuit 437<br>Basic FET amplifier circuit 438<br>The class-A amplifier 439<br>The class-AB amplifier 440<br>The class-B amplifier 441<br>The class-C amplifier 442<br>PA efficiency 443<br>Drive and overdrive 445<br>Audio amplification 446<br>Coupling methods 447<br>Radio-frequency amplification 450<br>Quiz 453<br>25 Oscillators 457<br>Uses of oscillators 457<br>Positive feedback 458<br>Concept of the oscillator 458<br>The Armstrong oscillator 459<br>The Hartley circuit 459<br>The Colpitts circuit 461<br>The Clapp circuit 461<br>Stability 463<br>Crystal-controlled oscillators 464<br>The voltage-controlled oscillator 465<br>The PLL frequency synthesizer 466<br>Diode oscillators 467<br>Audio waveforms 467<br>Audio oscillators 468<br>IC oscillators 469<br>Quiz 469<br>26 Data transmission 474<br>The carrier wave 474<br>The Morse code 475<br>Frequency-shift keying 475<br>Amplitude modulation for voice 478<br>Single sideband 480<br><br>xvi Contents<br>Frequency and phase modulation 482<br>Pulse modulation 485<br>Analog-to-digital conversion 487<br>Image transmission 487<br>The electromagnetic field 490<br>Transmission media 493<br>Quiz 495<br>27 Data reception 499<br>Radio wave propagation 499<br>Receiver specifications 502<br>Definition of detection 504<br>Detection of AM signals 504<br>Detection of CW signals 505<br>Detection of FSK signals 506<br>Detection of SSB signals 506<br>Detection of FM signals 506<br>Detection of PM signals 508<br>Digital-to-analog conversion 509<br>Digital signal processing 510<br>The principle of signal mixing 511<br>The product detector 512<br>The superheterodyne 515<br>A modulated-light receiver 517<br>Quiz 517<br>28 Integrated circuits and data storage media 521<br>Boxes and cans 521<br>Advantages of IC technology 522<br>Limitations of IC technology 523<br>Linear versus digital 524<br>Types of linear ICs 524<br>Bipolar digital ICs 527<br>MOS digital ICs 527<br>Component density 529<br>IC memory 530<br>Magnetic media 532<br>Compact disks 535<br>Quiz 535<br>29 Electron tubes 539<br>Vacuum versus gas-filled 539<br>The diode tube 540<br>The triode 541<br>Extra grids 542<br>Some tubes are obsolete 544<br><br>Contents xvii<br>Radio-frquency power amplifiers 544<br>Cathode-ray tubes 546<br>Video camera tubes 547<br>Traveling-wave tubes 549<br>Quiz 551<br>30 Basic digital principles 555<br>Numbering systems 555<br>Logic signals 557<br>Basic logic operations 559<br>Symbols for logic gates 561<br>Complex logic operators 561<br>Working with truth tables 562<br>Boolean algebra 564<br>The flip-flop 564<br>The counter 566<br>The register 567<br>The digital revolution 568<br>Quiz 568<br>Test: Part 3 572<br>Part 4 Advanced electronics and related technology<br>31 Acoustics, audio, and high fidelity 583<br>Acoustics 583<br>Loudness and phase 585<br>Technical considerations 587<br>Basic components 589<br>Other components 591<br>Specialized systems 596<br>Recorded media 597<br>Electromagnetic interference 601<br>Quiz 602<br>32 Wireless and personal communications systems 606<br>Cellular communications 606<br>Satellite systems 608<br>Acoustic transducers 612<br>Radio-frequency transducers 613<br>Infrared transducers 614<br>Wireless local area networks 615<br>Wireless security systems 616<br>Hobby radio 617<br>Noise 619<br>Quiz 620<br><br>xviii Contents<br>33 Computers and the Internet 624<br>The microprocessor and CPU 624<br>Bytes, kilobytes, megabytes, and gigabytes 626<br>The hard drive 626<br>Other forms of mass storage 628<br>Random-access memory 629<br>The display 631<br>The printer 633<br>The modem 635<br>The Internet 636<br>Quiz 640<br>34 Robotics and artificial intelligence 644<br>Asimov’s three laws 644<br>Robot generations 645<br>Independent or dependent? 646<br>Robot arms 648<br>Robotic hearing and vision 652<br>Robotic navigation 657<br>Telepresence 661<br>The mind of the machine 663<br>Quiz 665<br>Test: Part 4 669<br>Final exam 679<br>Appendices<br>A Answers to quiz, test, and exam questions 697<br>B Schematic symbols 707<br>Suggested additional reference 713<br>Index 715
【中英】【吴恩达课后测验】Course 1 - 神经网络和深度学习 - 第一周测验
【中英】【吴恩达课后测验】Course 1 - 神经网络和深度学习 - 第一周测验 上一篇:【目录】※※※※※ 【回到目录】※※※※※下一篇:【课程1 - 第二周测验】 第一周测验 - 深度学习简介 和“AI是新电力”相类似的说法是什么? 【  】AI为我们的家庭和办公室的个人设备供电,类似于电力。 【  】通过“智能电网”,AI提供新的电能。 【 】AI在计算机上运行,​​并...
Electricity
Electricity 题意:两种插头的多种排插,插头只能按照如图所示的方法连接,问最多有多少个可以使用(即还没被插上)的A型插座 解法:直接贪心就好,分别记录A,B型的插头数目,并把数量多的尽量安排在前面就行了#include <iostream> using namespace std; #include <stdio.h> #include <stdlib.h> #include <alg
coursera deep learning course3 week1
正交化(orthogonlization) 每个算法、技巧只解决一个问题,而不要对很多方面都产生影响。 早停(early stopping)既影响对训练集的训练,又对验证集有提高。 单一数字评估指标(single number evaluation metric) 以一个指标作为最终优化的指标。 满意指标与优化指标(satisficing and optimizing metric) 选
IET Protection of Electricity Distribution Networks
Protection of Electricity Distribution Networks
Classical Electricity and Magnetism
Classical Electricity and Magnetism