↓ Skip to main content

Posts

2015

51nod 1106 质数检测(miller rabin 素数测试.)

·373 words·1 min
1106 质数检测 基准时间限制:1 秒 空间限制:131072 KB 分值: 0 难度:基础题 收藏 关注 给出N个正整数,检测每个数是否为质数。如果是,输出"Yes",否则输出"No"。

hdu 2531 Catch him (bfs)

·1300 words·3 mins
Catch him # **Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 664 Accepted Submission(s): 307 ** Problem Description 在美式足球中,四分卫负责指挥整只球队的进攻战术和跑位,以及给接球员传球的任务。四分卫是一只球队进攻组最重要的球员,而且一般身体都相对比较弱小,所以通常球队会安排5-7名大汉来保护他,其中站在四分卫前方、排成一线的5名球员称为进攻锋线,他们通常都是135公斤左右的壮汉。

codeforces #324 div 2 A. Olesya and Rodion

·377 words·1 min
A. Olesya and Rodion time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Olesya loves numbers consisting of n digits, and Rodion only likes numbers that are divisible by t. Find some number that satisfies both of them. Your task is: given the n and t print an integer strictly larger than zero consisting of n digits that is divisible by t. If such number doesn’t exist, print - 1. Input

51nod_learn_greedy_活动安排2

·532 words·2 mins
有若干个活动,第i个开始时间和结束时间是[Si,fi),同一个教室安排的活动之间不能交叠,求要安排所有活动,最少需要几个教室? 1第一行一个正整数n (n <= 10000)代表活动的个数。 2第二行到第(n + 1)行包含n个开始时间和结束时间。 3开始时间严格小于结束时间,并且时间都是非负整数,小于1000000000 输出 一行包含一个整数表示最少教室的个数。 输入示例

codeforces #323 div 2 C. GCD Table (暴力?)

·960 words·2 mins
C. GCD Table time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output The GCD table G of size n × n for an array of positive integers a of length n is defined by formula Let us remind you that the greatest common divisor (GCD) of two positive integers x and y is the greatest integer that is divisor of both x and y, it is denoted as . For example, for array a = {4, 3, 6, 2} of length 4 the GCD table will look as follows: