64位有符号整数问题
想问一下为什么这道题题目里说输入不超过64位有符号整数的表示范围,但是用unsigned long long int 处理不行,要手动模拟?http://acm.xidian.
#include <stdio.h> int main( void ) { for( unsigned long long n; scanf("%llu",&n)==1; ) { if( n%10 >= 5 ) n += 10; printf( "%llu.%02llu\n", n/1000, n%1000/10 ); } }
#include<iostream> #include<functional> #include<iomanip> using namespace std; unsigned long long int a; int main(void){ double b; while(cin>>a){ b=(double)a; b/=1000; cout<<fixed<<setprecision(2)<<b<<endl; } return 0; }
[此贴子已经被作者于2018-12-15 00:10编辑过]