摘要:
One of the programming paradigm in parallel processing is the producer/consumer paradigm that can be implemented using a system with a "manager" proce 阅读全文
摘要:
Pascal University, one of the oldest in the country, needs to renovate its Library Building, because after all these centuries the building started to 阅读全文
摘要:
Given the input 22, the following sequence of numbers will be printed 22 11 34 17 52 26 13 40 20 10 5 16 8 4 2 1 It is conjectured that the algorithm 阅读全文
摘要:
这道题可以使用数学公式计算出来。一共工作了n天,则n=1+2+3+4+...+a+b,0<=b<a+1,如n=16,则a=5,b=1。设0.5*(a02+a0)=n,由函数y=0.5*(x2+x)的函数图像可知,0<=a0-a<1。a0向下取整,得到a。然后这道题国王需要支付的金币就可以分两部分计算 阅读全文
摘要:
In 1949 the Indian mathematician D.R. Kaprekar discovered a class of numbers called self-numbers. For any positive integer n, define d(n) to be n plus 阅读全文
摘要:
这道题不怎么难,在每计算一次路程后,需要将这次输入的时间保存起来,下一次计算的时候,输入的时间需要减去上次保存的时间。 1 #include<stdio.h> 2 3 int main(void) 4 { 5 int i;//用于循环 6 int n; 7 int s,t,sum;//速度,时间,总 阅读全文
摘要:
不知道为什么在POJ上就是通不过编译。。。 因为数据范围并不大,所以可以离线计算出所有的丑数。 说实话这个算法是网上找的,但是没有怎么看懂。 1 #include<stdio.h> 2 #include<string.h> 3 4 5 int a[1510];//丑数数组 6 7 int min(i 阅读全文
摘要:
Write a program to read four lines of upper case (i.e., all CAPITAL LETTERS) text input (no more than 72 characters per line) from the input file and 阅读全文
摘要:
使用的是高中数学的一个公式,p=(a+b+c)/2,s=sqrt(p*(p-a)*(p-b)*(p-c)),由正弦定理a/sinA=b/sinB=c/sinC=2r,s=0.5*a*b*sinC,所以r=a*b*c/(4*s),然后就可以求周长了。 1 #include <stdio.h> 2 #i 阅读全文
摘要:
Problem A: Good evening, contestants. If a and d are relatively prime positive integers, the arithmetic sequence beginning with a and increasing by d, 阅读全文