03 2019 档案

摘要:1.快速幂: 用11举例,11=2^0+2^1+2^3 1 int main() 2 { 3 ll a,b; 4 while(cin>>a>>b){ 5 ll ans=1,p=a; 6 while(b){ 7 if(b&1) 8 ans*=p; 9 p*=p; 10 b>>=1; 11 } 12 c 阅读全文
posted @ 2019-03-30 15:57 XXrl 阅读(115) 评论(0) 推荐(0)
摘要:贪心:一直超时,查了后发现要标记. 不过sun和v不写>0会出错? http://poj.org/problem?id=3040 1 #include<iostream> 2 #include<cmath> 3 #include<cstring> 4 #include<algorithm> 5 us 阅读全文
posted @ 2019-03-29 18:41 XXrl 阅读(111) 评论(0) 推荐(0)
摘要:1.贪心:最优队列 http://poj.org/problem?id=3253 倒推,最小的两个和在一起,加入队列(模拟倒割) #include<iostream> #include<algorithm> #include<queue> #define LL long long using nam 阅读全文
posted @ 2019-03-29 18:38 XXrl 阅读(151) 评论(0) 推荐(0)
摘要:1.最大公约数 1 int euc(int a,int b) 2 { 3 return a%b==0?b:euc(b,a%b); 4 } 5 int main() 6 { 7 int a,b; 8 while(cin>>a>>b) 9 printf("%d\n",euc(a,b)); 10 retu 阅读全文
posted @ 2019-03-22 20:26 XXrl 阅读(134) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 #include 4 using namespace std; 5 int main() 6 { 7 int *p,i=1; 8 p=&i; 9 cout<<"*p: "<<*p<<endl<<"&p: "<<&p<<endl<<"p: "<<p<<endl<<"i: "<<&i<<endl; 阅读全文
posted @ 2019-03-13 18:15 XXrl 阅读(455) 评论(0) 推荐(0)