A - 3.14

Problem Statement

The number pi to the 100100-th decimal place is

3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679

You are given an integer N between 11 and 100100, inclusive.

Print the value of pi to the N-th decimal place.

More precisely, truncate the value of pi to N decimal places and print the result without removing the trailing 0s.

Constraints

  • 1≤N≤100
  • N is an integer.

Input

The input is given from Standard Input in the following format:

N

Output

Print the value of pi to the N-th decimal place in a single line.


Sample Input 

2

Sample Output 

3.14

题目大意:给定一个精确到小数点后100位的pi值和一个整数N,按要求输入整数N并精确地输出小数点后第N位的pi值。

思路:将以上pi值当作字符串来解。

#include <bits/stdc++.h>
using namespace std;

const int N = 1e5 + 5;



int main() {
	string pi = "3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679";
	int i = 0;
	int n = 0;
	cin >> n;
	for (i = 0; i <= n + 1; i++) {
		cout << pi[i];
	}
	return 0;
}

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值