CF1790A.Polycarp and the Day of Pi
入门
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
On March 14, the day of the number π 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 π is irrational, therefore it has an infinite number of digits in decimal notation. He wanted to prepare for the Day of the number π by memorizing this number as accurately as possible.
Polycarp wrote out all the digits that he managed to remember. For example, if Polycarp remembered π 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 π Polycarp actually remembers correctly.
3月14日是全球庆祝圆周率 π 的日子。π 是一个非常重要的数学常数,其值等于圆的周长与其直径的比值。
波利卡普在学校里学到,π 是一个无理数,因此它在十进制表示下具有无穷多位小数。他想通过尽可能准确地记忆 π 来为圆周率日做准备。
波利卡普写下了他所能记住的所有数字。例如,若波利卡普将 π 记为 3.1415,则他写出的是 31415。
由于波利卡普比较匆忙,可能出错,因此你决定检查波利卡普实际正确记住的 π 的前多少位数字。
输入格式
The first line of the input data contains the single integer t (1≤t≤103) — 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.
输入数据的第一行包含一个整数 t(1≤t≤103)—— 表示测试用例的数量。
每个测试用例由一个仅包含数字的字符串 n 描述,该字符串由 Polycarp 写出。
字符串 n 最多包含 30 位数字。
输出格式
Output t integers, each of which is the answer to the corresponding test case, that is how many first digits of the number π Polycarp remembers correctly.
输出 t 个整数,每个整数对应一个测试用例的答案,即 Polycarp 正确记住的圆周率 π 的前几位数字的位数。
输入输出样例
输入#1
9 000 3 4141592653 141592653589793238462643383279 31420 31415 314159265358 27182 314159265358979323846264338327
输出#1
0 1 0 0 3 5 12 0 30
输入解题思路,AI测评打分。不知道怎么写?