题目链接:http://lightoj.com/volume_showproblem.php? problem=1043 题意:一个三角形ABC,DE//BC.已知三角形ADE和四边形BDEC的面积的比,求AD的长度. 解法:二分AD边就可以 代码: #include <stdio.h> #include <ctime> #include <math.h> #include <limits.h> #include <complex> #inclu…
1043 - Triangle Partitioning PDF (English) Statistics Forum Time Limit: 0.5 second(s) Memory Limit: 32 MB See the picture below. You are given AB, AC and BC. DE is parallel to BC. You are also given the area ratio between ADE and BDEC. You have to fi…
1043 - Triangle Partitioning   PDF (English) Statistics Forum Time Limit: 0.5 second(s) Memory Limit: 32 MB See the picture below. You are given AB, AC and BC. DE is parallel to BC. You are also given the area ratio between ADE and BDEC. You have to…
题意:给出一个n面的色子,问看到每个面的投掷次数期望是多少. 析:这个题很水啊,就是他解释样例解释的太...我鄙视他,,,,, dp[i] 表示 已经看到 i 面的期望是多少,然后两种选择一种是看到新的一面,另一种是看到旧的一面,然后就很出答案了. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000000") #include <cstdio> #include <string> #include &…
lightoj 1020 A Childhood Game 链接:http://lightoj.com/volume_showproblem.php?problem=1020 题意:一堆石子有 m 个,Alice和Bob可以从中取1个或者2个,如果Alice先取,最后取的人败:如果Bob先取,最后取的人胜.问胜利者. 思路:枚举前几个石子的情况,很容易找出每种情况的必败点,找规律.如果Alice先取,Alice的必败点为mod 3 == 1,如果Bob先取,Bob必败点在 mod 3 == 0处…
http://www.lightoj.com/volume_showproblem.php?problem=1023 题意:26字母全排列 思路:用next_permutation或者思维想一下都可以 /** @Date : 2016-12-17-13.28 * @Author : Lweleth (SoungEarlf@gmail.com) * @Link : https://github.com/ * @Version : */ #include<bits/stdc++.h> #defin…
The Triangle 时间限制:1000 ms  |  内存限制:65535 KB 难度:4 描述 7 3 8 8 1 0 2 7 4 4 4 5 2 6 5 (Figure 1) Figure 1 shows a number triangle. Write a program that calculates the highest sum of numbers passed on a route that starts at the top and ends somewhere on t…
#include <iostream> #include <cstdio> #include <cmath> using namespace std; const int maxN = 100005; int a[maxN]; int t, tt; int n, q, x, y; int Bsearch_lower_bound(int x) { int l = 0, r = n - 1, mid = 0; while (l <= r) { mid = (l + r…
java有大数模板 import java.util.Scanner; import java.math.*; public class Main { public static void main(String[] args) { Scanner cin =new Scanner(System.in); int T=cin.nextInt(); BigInteger c=BigInteger.valueOf(0); for(int i=1;i<=T;++i){ BigInteger a=cin…
暴力就行了,找出素因子,正的最多是30,然后负的最多是31(这一点wa了一次) #include <cstdio> #include <iostream> #include <ctime> #include <vector> #include <cmath> #include <map> #include <queue> #include <algorithm> #include <cstring>…