ZOJ First Digit(瞎搞)
基本上就是英文閱讀啊,很扯輸出“1”就ok了啊。滿足所有的情況。
Benford's Law, also called the First-Digit Law, refers to the frequency distribution of digits in many (but not all) real-life sources of data. In this distribution, the number 1 occurs as the leading digit about 30% of the time, while larger numbers occur in that position less frequently: 9 as the first digit less than 5% of the time. Benford's Law also concerns the expected distribution for digits beyond the first, which approach a uniform distribution.
This result has been found to apply to a wide variety of data sets, including electricity bills, street addresses, stock prices, population numbers, death rates, lengths of rivers, physical and mathematical constants, and processes described by power laws (which are very common in nature). It tends to be most accurate when values are distributed across multiple orders of magnitude.
A set of numbers is said to satisfy Benford's Law if the leading digit d ∈ {1, ..., 9} occurs with probability P(d) = log10(d + 1) - log10(d). Numerically, the leading digits have the following distribution in Benford's Law:
d | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
---|---|---|---|---|---|---|---|---|---|
P(d) | 30.1% | 17.6% | 12.5% | 9.7% | 7.9% | 6.7% | 5.8% | 5.1% | 4.6% |
Now your task is to predict the first digit of be, while b and e are two random integer generated by discrete uniform distribution in [1, 1000]. Your accuracy rate should be greater than or equal to 25% but less than 60%. This is not a school exam, and high accuracy rate makes you fail in this task. Good luck!
Input
There are multiple test cases. The first line of input contains an integer T (about 10000) indicating the number of test cases. For each test case:
There are two integers b and e (1 <= b, e <= 1000).
Output
For each test case, output the predicted first digit. Your accuracy rate should be greater than or equal to 25% but less than 60%.
Sample Input
20 206 774 133 931 420 238 398 872 277 137 717 399 820 754 997 463 77 791 295 345 375 501 102 666 95 172 462 893 509 839 20 315 418 71 644 498 508 459 358 767
Sample Output
8 2 2 1 4 2 1 2 1 1 4 6 2 4 9 7 2 7 1 7
Hint
The actual first digits of the sample are 8, 2, 2, 1, 4, 2, 1, 2, 1, 1, 3, 5, 1, 3, 8, 6, 1, 6, 9 and 6 respectively. The sample output gets the first 10 cases right, so it has an accuracy rate of 50%.
#include <algorithm>
#include <iostream>
#include <stdlib.h>
#include <string.h>
#include <iomanip>
#include <stdio.h>
#include <string>
#include <queue>
#include <cmath>
#include <stack>
#include <map>
#include <set>
#define eps 1e-8
#define M 1000100
//#define LL __int64
#define LL long long
#define INF 0x7ffffff
#define PI 3.1415926535898
const int maxn = 1010;
using namespace std;
double dp[maxn][maxn];
int main()
{
int n;
while(cin >>n)
{
int x, y;
while(n--)
{
cin >>x>>y;
cout<<"1"<<endl;
}
}
return 0;
}
相關文章
- oracle lz047中的REGEXP_LIKE(cust_first_name,'[[:digit:]]')) 轉OracleGit
- HDU 4925 Apple Tree (瞎搞)APP
- Nth Digit【難】Git
- HDU 4923 Room and Moor(瞎搞題)OOM
- Last digit of a huge numberASTGit
- HDU 2478 Slides(瞎搞,預處理)IDE
- LintCode-Digit CountsGit
- ZOJ 3732 Graph ReconstructionStruct
- ZOJ 1048 Financial ManagementNaN
- OCP(11g)-----> oracle First In First Out (FIFO)/Last In First OutOracleAST
- Nth Digit 第N個數字Git
- LeetCode-Number of Digit OneLeetCodeGit
- 233. Number of Digit OneGit
- UVa 1225 - Digit CountingGit
- Leetcode 400.Nth DigitLeetCodeGit
- HDU 1060 Leftmost DigitGit
- ZOJ 3789 Gears(並查集)並查集
- ZOJ 1013 Great Equipment(DP)UI
- jQuery first()jQuery
- jQuery :firstjQuery
- Digit Counting uva1225Git
- :first-child與:first-of-type 區別
- ZOJ 3875 Lunch Time(結構體排序)結構體排序
- ZOJ 2745 01-K Code(DP)(轉)
- Entity Framework Code-First(2):What is Code-First?Framework
- Entity Framework Code-First(4):Simple Code First ExampleFramework
- Entity Framework Code-First(5):Code First ConventionsFramework
- first oracle sqlOracleSQL
- ZOJ Problem Set - 1094 Matrix Chain MultiplicationAI
- ZOJ Problem Set - 1016 ParencodingsEncoding
- 動態規劃-ZOJ 1 163 THE STAIRCASES動態規劃AI
- ZOJ 4846 GCD Reduce (數學分析題)GC
- ZOJ Consecutive Blocks(左右指標移動)BloC指標
- zoj 1093 dp Monkey and BananaNaN
- FIRST_ROWS和FIRST_ROWS_n的區別
- FIRST_ROWS和FIRST_ROWS(N)的區別 (zt)
- ZOJ Problem Set - 3708 Density of Power Network
- jQuery :first-of-typejQuery