CodeForces 567C Geometric Progression
来源:互联网 发布:手机淘宝交电费 编辑:程序博客网 时间:2024/05/22 02:21
题意:从一个长度为n的序列中,选出3个数,要求l1<l2<l3,使得构成一个等比为k的等比数列,问你有多少个
思路:开两个map分别维护这个数前面和后面的每类数的个数,然后瞎搞搞
#include<bits/stdc++.h>using namespace std;const int maxn = 200000+100;#define LL long longmap<LL,LL>mark1;map<LL,LL>mark2;LL a[maxn];int main(){ int n,k; scanf("%d%d",&n,&k); for (int i = 1;i<=n;i++) { scanf("%lld",&a[i]); mark2[a[i]]++; } LL ans = 0; for (int i = 1;i<=n;i++) { mark2[a[i]]--; if (a[i]%k==0) { ans+=mark1[a[i]/k]*mark2[a[i]*k]; } mark1[a[i]]++; } printf("%lld\n",ans);}
0 0
- codeforces(567C)-- Geometric Progression
- codeforces 567C Geometric Progression
- Codeforces 567C Geometric Progression
- CodeForces 567C Geometric Progression
- CodeForces 567C Geometric Progression
- codeforces#314C&567C Geometric Progression
- codeforces 567C Geometric Progression (map维护)
- Codeforces 567C Geometric Progression (离散 + DP)
- CodeForces 567C Geometric Progression【思维+map】
- CodeForces #Pi C.Geometric Progression
- codeforces 567E C. Geometric Progression(dp+STL)
- CodeForces 567C. Geometric Progression(map 数学啊)
- CodeForces 567C. - Geometric Progression(解题报告)
- CF-567C - Geometric Progression
- CF 567C. Geometric Progression
- codeforce 567c Geometric Progression(map)
- CF 567C(Geometric Progression-map)
- Codeforces Round #Pi (Div. 2)567C Geometric Progression(map暴力)
- iOS解决插件失效问题
- NYOJ 55 懒省事的小明
- 标准和模型和IE盒模型
- Unity5 更改鼠标样式
- java.io------BufferedReader
- CodeForces 567C Geometric Progression
- web_for_pentest XSS系列
- 一个木马下载脚本
- JSP原理初探
- 面试之路(13)-android apk之间共享数据的方式以及shareUserId详解
- 最小生成树
- poj1207 The 3n + 1 problem
- 关于SVN Client的一点心得
- 完全大数(高精度)模版