关于%lld 和 %I64d

在Linux下输出long long 类型的是 

printf("%lld", a);

在Windows下输出是

printf("%I64d", a);

xxy学姐:"如果不知道测评机是啥的咋办?”

“像这样!!”

#ifdef Linux
#define LL "%lld"
#else 
#define LL "%I64d"
#endif

eg:

#include <cstdio>
#include <iostream>
#ifdef Linux
#define LL "%lld"
#else 
#define LL "%I64d"
#endif
using namespace std;
int main() {
    long long a;
    cin >> a;
    printf(LL, a);
    return 0;
}

艹!我以后要是再写错这个玩意儿, 我对象就是狗!艹

猜你喜欢

转载自www.cnblogs.com/yanxiujie/p/11624763.html