310152: CF1790A. Polycarp and the Day of Pi

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Polycarp and the Day of Pi

题意翻译

Polycarp 将圆周率的前几位去掉小数点写下来。例如 $3.1415$ 写作 $31415$。 对于每组数据,输入一个长度在 $30$ 以内的字符串,表示这次他写下的圆周率。输出这个字符串中的前多少位是正确的。 translated by @[StayAlone](https://www.luogu.com.cn/user/409236)

题目描述

On March 14, the day of the number $ \pi $ is celebrated all over the world. This is a very important mathematical constant equal to the ratio of the circumference of a circle to its diameter. Polycarp was told at school that the number $ \pi $ is irrational, therefore it has an infinite number of digits in decimal notation. He wanted to prepare for the Day of the number $ \pi $ by memorizing this number as accurately as possible. Polycarp wrote out all the digits that he managed to remember. For example, if Polycarp remembered $ \pi $ as $ 3.1415 $ , he wrote out 31415. Polycarp was in a hurry and could have made a mistake, so you decided to check how many first digits of the number $ \pi $ Polycarp actually remembers correctly.

输入输出格式

输入格式


The first line of the input data contains the single integer $ t $ ( $ 1 \le t \le 10^3 $ ) — the number of test cases in the test. Each test case is described by a single string of digits $ n $ , which was written out by Polycarp. The string $ n $ contains up to $ 30 $ digits.

输出格式


Output $ t $ integers, each of which is the answer to the corresponding test case, that is how many first digits of the number $ \pi $ Polycarp remembers correctly.

输入输出样例

输入样例 #1

9
000
3
4141592653
141592653589793238462643383279
31420
31415
314159265358
27182
314159265358979323846264338327

输出样例 #1

0
1
0
0
3
5
12
0
30

Input

题意翻译

Polycarp 将圆周率的前几位去掉小数点写下来。例如 $3.1415$ 写作 $31415$。 对于每组数据,输入一个长度在 $30$ 以内的字符串,表示这次他写下的圆周率。输出这个字符串中的前多少位是正确的。 translated by @[StayAlone](https://www.luogu.com.cn/user/409236)

Output

**题目大意**:

在圆周率日,Polycarp尝试记忆圆周率π。他将π的小数点后的数字连在一起写下来,例如π=3.1415时,他会写下31415。现在需要检查Polycarp写下的数字中有多少位是正确的。

**输入输出数据格式**:

**输入格式**:
- 第一行包含一个整数t(1≤t≤10^3),表示测试用例的数量。
- 每个测试用例由一个字符串n组成,字符串n是Polycarp写下的数字。
- 字符串n的长度不超过30位。

**输出格式**:
- 输出t个整数,每个整数对应一个测试用例的答案,即Polycarp正确记住的圆周率π的前多少位数字。

**输入输出样例**:

**输入样例**:
```
9
000
3
4141592653
141592653589793238462643383279
31420
31415
314159265358
27182
314159265358979323846264338327
```

**输出样例**:
```
0
1
0
0
3
5
12
0
30
```**题目大意**: 在圆周率日,Polycarp尝试记忆圆周率π。他将π的小数点后的数字连在一起写下来,例如π=3.1415时,他会写下31415。现在需要检查Polycarp写下的数字中有多少位是正确的。 **输入输出数据格式**: **输入格式**: - 第一行包含一个整数t(1≤t≤10^3),表示测试用例的数量。 - 每个测试用例由一个字符串n组成,字符串n是Polycarp写下的数字。 - 字符串n的长度不超过30位。 **输出格式**: - 输出t个整数,每个整数对应一个测试用例的答案,即Polycarp正确记住的圆周率π的前多少位数字。 **输入输出样例**: **输入样例**: ``` 9 000 3 4141592653 141592653589793238462643383279 31420 31415 314159265358 27182 314159265358979323846264338327 ``` **输出样例**: ``` 0 1 0 0 3 5 12 0 30 ```

加入题单

算法标签: