D. Vitaly and Cycle Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/557/problem/D Description After Vitaly was expelled from the university, he became interested in the graph theory. Vitaly especially liked the cycles of an…
题目链接: 点这里 题目 D. Vitaly and Cycle time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output 问题描述 After Vitaly was expelled from the university, he became interested in the graph theory. Vitaly especially…
D. Vitaly and Cycle time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output After Vitaly was expelled from the university, he became interested in the graph theory. Vitaly especially liked the cycl…
http://www.cnblogs.com/wenruo/p/4959509.html 给一个图(不一定是连通图,无重边和自环),求练成一个长度为奇数的环最小需要加几条边,和加最少边的方案数. 很容易知道连的边数只能是0,1,2,3. 如果是二分图一定不含长度为奇数的环. 难点是如果是二分图怎么求方案数呢? 二分图染色时能求出每一个联通块.在每一个联通块中把任意两个颜色相同的点连一条边即可达到要求. 如图中红色和绿色的边就是部分可行解 代码(含注释): /*******************…
A. Ilya and Diplomas 思路:水题了, 随随便便枚举一下,分情况讨论一下就OK了. code: #include <stdio.h> #include <stdlib.h> #include <string.h> #include <algorithm> #include <iostream> #include <cstring> #include <cmath> #define inf 1000000…
A. Ilya and Diplomas time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Soon a school Olympiad in Informatics will be held in Berland, n schoolchildren will participate there. At a meeting of…
A. Vitaly and Night Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/595/problem/A Description One day Vitaly was going home late at night and wondering: how many people aren't sleeping at that moment? To estimate, Vitaly de…
E. Ann and Half-Palindrome Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/557/problem/E Description Tomorrow Ann takes the hardest exam of programming where she should get an excellent mark. On the last theoretical class t…
C. Arthur and Table Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/557/problem/C Description Arthur has bought a beautiful big table into his new flat. When he came home, Arthur noticed that the new table is unstable. In t…
B. Pasha and Tea Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/557/problem/B Description Pasha decided to invite his friends to a tea party. For that occasion, he has a large teapot with the capacity of w milliliters and…