标签:int man 直接 序列 ++ cin ble 1.0 str
#include <stdio.h>
#include "stdafx.h"
#include <iostream>
#include<time.h>
#include<iomanip>
using std::cin;
using std::cout;
int main() {
long long n, m,temp;
cin >> n >> m;
if (n > m) {
temp = n;
n = m;
m = temp;
}
double sum = 0;
if (m < 1000000) {
for (long long i = n; i <= m; i++) {
sum += 1.0 / (i*i);
}
}
cout << sum<<std::endl;
}
题目提示有陷阱,猜测应该是溢出问题,所以直接使用了long long类型
标签:int man 直接 序列 ++ cin ble 1.0 str
原文地址:https://www.cnblogs.com/NK-007/p/9168888.html