跳至正文

USACO 2.4 Cow Tours 牛的旅行 解题报告

Cow Tours 
Farmer John has a number of pastures on his farm. Cow paths connect some pastures with certain other pastures, forming a field. But, at the present time, you can find at least two pastures that cannot be connected by any sequence of cow paths, thus[......]

继续阅读

USACO 2.4 Overfencing 穿越栅栏 解题报告

USACO 2.4 Overfencing 穿越栅栏 
Overfencing 
Kolstad and Schrijvers 
Farmer John went crazy and created a huge maze of fences out in a field. Happily, he left out two fence segments on the edges, and thus created two exits for the maze. Even more happily, the maze[......]

继续阅读

USACO 2.2 Subset Sums集合 解题报告

USACO 2.2 Subset Sums集合
For many sets of consecutive integers from 1 through N (1 <= N <= 39), one can partition the set into two sets whose sums are identical.
For example, if N=3, one can partition the set {1, 2, 3} in one way so that the sums of both[……]

继续阅读

Packing Rectangles 铺放矩形块 (IOI 95)

Packing Rectangles 铺放矩形块 (IOI 95)

在网上看了挺多解释这一题的文章,总感觉没看大懂,所以自己写一篇文章吧。希望能够帮助大家理解一下这一题。题目如下:

http://www.nocow.cn/index.php/Translate:USACO/packrec

开始拿到题目确实没怎么看懂,网上也有很多人说它是个水题,我倒感觉不以为然,我看了一些网上的人写的代码,说它是水题的人都是怎么写的。整个程序框架就是第一种情况循环+判断,第二种情况循环+判断,…………(以此类推)

接下来我来说下我的[……]

继续阅读

我的暑期作息时间表

  • 随笔

日子每天过的太不充实了,本来规定每天三题,总是东玩下QQ,西学下别的,做个一题不到。本来打算暑假多看数学,Linux的操作,还有Vim的操作的,结果全没弄,暑假已经过了一半了,希望现在定作息时间表不要太迟了。
具体作息时间如下:

开始时间
结束时间
作业

早上起床
9:30
数据结构与算法分析

9:30
10:00
Linux内核

10:00
10:30
算法导论

10:30
11:00
数学课

11:00
11:30
算法导论

11:30
12:00
鸟哥Linux教程

12[……]

继续阅读

ISBN号码 解题报告

  • OI路程

这题很简单,一位一位算就是,唯一要注意的就是mod 11 = 10的时候,要用X。代码:

C语言:

#include <stdio.h>
#include <ctype.h>
char isbn[14];

char getint(void)
{
 static int i = 0;
 int t;
 do{
 t = isbn[i++];
 }while(!isdigit(t));
 return t - \'0\';
}

int main(void)
{
 int[......]

继续阅读

不高兴的津津 解题报告

  • OI路程

不知道这题该属于哪个类别,,贪心?枚举?反正不难,,代码:

C语言:

#include <stdio.h>

int main(void)
{
 int i;
 int a, b;
 int ans = 0, t = 0;
 for(i = 1; i <= 7; i++){
 scanf(%d%d, &a, &b);
 if((a + b > 8) && (a + b > t)){
 ans = i;
 t = a + b;
 }
 }
 printf([......]

继续阅读

计数的梦 解题报告

  • OI路程

这题的话,怎么说呢?就是暴力!!

C语言:

#include <stdio.h>
int ans[10];

void count(int num)
{
 while(num != 0){
 ans[num % 10]++;
 num /= 10;
 }
}

int main(void)
{
 int i, j;
 scanf(%d%d, &i, &j);
 while(i <= j){
 count(i++);
 }
 for(i = 0; i < 10; i++){[......]

继续阅读

A+B Problem 解题报告

  • OI路程

这题不会做,那你就应该砸机子了。

C语言:

#include <stdio.h>

int main(void)
{
 int i, j;
 scanf(%d%d, &i, &j);
 printf(%d\\n, i + j);
 return 0;
}

[……]

继续阅读