• 注意事项


    1. 有关1<<64。测试:
    using namespace std;
    #include <iostream>
    int main(){
    	cout<<(1<<64)<<endl;
    	cout<<(1ll<<64)<<endl;
    	cout<<(1ull<<64)<<endl;
    	
    	int k=64;
    	cout<<(1<<k)<<endl;
    	cout<<(1ll<<k)<<endl;
    	cout<<(1ull<<k)<<endl;
    	return 0;
    }
    

    结果:

    0
    0
    0
    1
    1
    1
    

    所以不要随便左移64位。


    1. 有关四舍五入:
    using namespace std;
    #include <cstdio>
    #include <cmath>
    int main(){
    	double a=0.5,b=0.5+1e-16,c=0.5+1e-17,d=0.5-1e-16;
    	printf("%.0lf
    ",a);
    	printf("%.0lf
    ",b);
    	printf("%.0lf
    ",c);
    	printf("%.0lf
    ",d);
    	printf("%lf
    ",round(a));
    	printf("%lf
    ",round(b));
    	printf("%lf
    ",round(c));
    	printf("%lf
    ",round(d));
    	return 0;
    }
    

    结果:

    0
    1
    0
    0
    1.000000
    1.000000
    1.000000
    0.000000
    

    可以发现printf在刚好是0.5时四舍五入输出0round符合人类习惯。


    1. 如果定义某个函数,把它当过程使用,但是类型不是void而且函数中没有返回值,会出问题。
      在洛谷、LOJ、Atcoder上都出现过问题。
      没有用CCF的评测机试过。
  • 相关阅读:
    ovs QOS
    OpenvSwitch端口镜像
    MyCat入门指南
    Mycat跨分片Join
    MyCAT 命令行监控
    MyCat的分片规则
    FreeMarker初探--介绍
    FreeMarker初探--安装FreeMarker
    linux 安装配置zookeeper
    Maven 环境搭建及相应的配置
  • 原文地址:https://www.cnblogs.com/jz-597/p/13945888.html
Copyright © 2020-2023  润新知