Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <string>
- #include <iomanip>
- #include <queue>
- #include <cmath>
- #include <algorithm>
- #include <tuple>
- #include <iomanip>
- #include <stdio.h>
- #include <numeric>
- #include <map>
- #include <math.h>
- #include <bitset>
- #define int long long
- #define ull unsigned long long
- #define all(a) a.begin(), a.end()
- #define pii pair<int, int>
- #define pb push_back
- using namespace std;
- const double PI = 3.14159265358;
- long long gcd(long long a, long long b) {
- if (a==0) return b;
- if (b==0) return a;
- if (a>b) return gcd(a%b,b); else return gcd(b%a,a);
- }
- int prime(int p) {
- for (int i=2;i*i<=p;i++) {
- if (p%i==0 && i<p) return 0;
- }
- return 1;
- }
- double s(int x1, int y1, int x2, int y2) {
- return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
- }
- char w(char r){
- if (r == '0') return '1';
- if (r == '1') return '2';
- if (r == '2') return '3';
- if (r == '3') return '4';
- if (r == '4') return '5';
- if (r == '5') return '6';
- if (r == '6') return '7';
- if (r == '7') return '8';
- if (r == '8') return '9';
- return '0';
- }
- string t(string s) {
- reverse(all(s));
- if (s[0] - '0' >= 5) {
- // cout << "here\n";
- s[1] = w(s[1]);
- // cout << s[1] << "\n";
- int ind = 1;
- while (s[ind] == '0') {
- ind++;
- s[ind] = w(s[ind]);
- }
- }
- reverse(all(s));
- return s;
- }
- signed main()
- {
- ios_base::sync_with_stdio(0);
- cin.tie(0);
- cout.tie(0);
- string e = "7182818284590452353602875000";
- int n;
- cin >> n;
- if (n == 0) cout << 3;
- else {
- cout << "2.";
- string q;
- for (int i = 0; i < n + 1; i++) {
- q += e[i];
- }
- q = t(q);
- for (int i = 0; i < n; i++) cout << q[i];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement