一般有两种情况下要这么做 a)有些类型名字很长,用typedef定义一个名字短点的,你说的就是这种情况 b)命名一个更有含义的类型。例如如果我用long long保持金额信息,typedef long long Money.这样Money这个词就比long long清晰明了多了 不知道你在哪看到的例子,a类型的重定义要慎重,你这里ll极大...
typedeflonglongll; intmain(){ ll a; cin>>a; cout<
typedef long long ll; int main() { int n; cin >> n; vector<int> hap(n, 0); for (int i = 0; i < n; i++) { cin >> hap[i]; } vector<ll> dp(n + 1, 0); int max_bag = 0; for (int i = 0; i < n; i++) { if (hap[i] >= 0) { max_bag++; for (int...
类型的别名呀,和#define差不多
typedeflonglongll; typedefpair<int,int>pii; # define im INT_MAX # define umap unordered_map # define uset unordered_set # define f first # define s second # define pq priority_queue # define pb push_back # define ins insert # define INF LLONG_MAX ...
将优惠券的ai进行排序,枚举n张优惠券,若原有的钱m+满减的总金额(bi的和)大于当前ai,则优惠券能用,最后答案为(原有的钱m+(bi之和))的最大值#include <bits/stdc++.h>using namespace std;typedef long long ll;ll t;int n, m;struct discount{ ll re; ll cu;}d[100009];bool cmp(discount a,...
This is commonly used for "programming right down to the silicon," and you'll see it in systems programs. It can also be used for storing aBoolean flag in a bit rather than a char. A bit field must have a type ofint, unsigned int, or signed int(or a qualified version of one of...
This is commonly used for "programming right down to the silicon," and you'll see it in systems programs. It can also be used for storing aBoolean flag in a bit rather than a char. A bit field must have a type ofint, unsigned int, or signed int(or a qualified version of one of...