The 12th Zhejiang Provincial Collegiate Programming Contest - D
来源:互联网 发布:不可使知之 编辑:程序博客网 时间:2024/05/18 05:01
#include<cstdio>#include<cstring>using namespace std;long long f[200005];int vis[200005];int main(){ int t; int n; scanf("%d",&t); while(t--) { scanf("%d",&n); f[0]=0; memset(vis,0,sizeof(vis)); for(int i=1;i<=n;i++) { int x; scanf("%d",&x); f[i]=x+f[i-1]+(i-1-vis[x])*x; vis[x]=i; } long long ans=0; for(int i=1;i<=n;i++) ans+=f[i]; printf("%lld\n",ans); } return 0;}
0 0
- The 12th Zhejiang Provincial Collegiate Programming Contest - D
- The 12th Zhejiang Provincial Collegiate Programming Contest
- The 12th Zhejiang Provincial Collegiate Programming Contest - A
- The 12th Zhejiang Provincial Collegiate Programming Contest - G
- The 12th Zhejiang Provincial Collegiate Programming Contest - H
- The 12th Zhejiang Provincial Collegiate Programming Contest - J
- The 12th Zhejiang Provincial Collegiate Programming Contest - L
- Lunch Time【The 12th Zhejiang Provincial Collegiate Programming Contest】
- The 12th Zhejiang Provincial Collegiate Programming Contest(部分)
- The 12th Zhejiang Provincial Collegiate Programming Contest
- The 9th Zhejiang Provincial Collegiate Programming Contest->Problem D:D - Draw Something Cheat
- The 9th Zhejiang Provincial Collegiate Programming Contest->Problem D:D - Draw Something Cheat
- The 7th Zhejiang Provincial Collegiate Programming Contest
- The 6th Zhejiang Provincial Collegiate Programming Contest
- The 8th Zhejiang Provincial Collegiate Programming Contest / L - Javabeans
- The 8th Zhejiang Provincial Collegiate Programming Contest / M - Median
- The 8th Zhejiang Provincial Collegiate Programming Contest
- The 9th Zhejiang Provincial Collegiate Programming Contest
- 关于逻辑的训练题
- linux下JAVA开发环境配置
- poj1721CARDS
- PHP资源类型
- 表达式树
- The 12th Zhejiang Provincial Collegiate Programming Contest - D
- 面向对象(子父类中构造函数的特点-子类实例化过程)
- 读书笔记---vi编辑命令解析
- HDU1425 sort【水题】
- java web.xml 基本配置了解(1)
- UINavigationController导航栏传值、改变颜色
- 解决问题:maven3.3.1 的-Dmaven.multiModuleProjectDirectory system propery is not set
- mac常用快捷键
- zoj 3880 Demacia of the Ancients