hdu 5095模拟
来源:互联网 发布:国内皮鞋品牌 知乎 编辑:程序博客网 时间:2024/06/01 12:40
Linearization of the kernel functions in SVM
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 134 Accepted Submission(s): 83
Problem Description
SVM(Support Vector Machine)is an important classification tool, which has a wide range of applications in cluster analysis, community division and so on. SVM The kernel functions used in SVM have many forms. Here we only discuss the function of the form f(x,y,z) = ax^2 + by^2 + cy^2 + dxy + eyz + fzx + gx + hy + iz + j. By introducing new variables p, q, r, u, v, w, the linearization of the function f(x,y,z) is realized by setting the correspondence x^2<-> p, y^2 <-> q, z^2 <-> r, xy<-> u, yz <-> v, zx <-> w and the function f(x,y,z) = ax^2 + by^2 + cy^2 + dxy + eyz + fzx + gx + hy + iz + j can be written as g(p,q,r,u,v,w,x,y,z) = ap + bq + cr + du + ev + fw + gx + hy + iz + j, which is a linear function with 9 variables.
Now your task is to write a program to change f into g.
Now your task is to write a program to change f into g.
Input
The input of the first line is an integer T, which is the number of test data (T<120). Then T data follows. For each data, there are 10 integer numbers on one line, which are the coefficients and constant a, b, c, d, e, f, g, h, i, j of the function f(x,y,z) = ax^2 + by^2 + cy^2 + dxy + eyz + fzx + gx + hy + iz + j.
Output
For each input function, print its correspondent linear function with 9 variables in conventional way on one line.
Sample Input
20 46 3 4 -5 -22 -8 -32 24 272 31 -5 0 0 12 0 0 -49 12
Sample Output
46q+3r+4u-5v-22w-8x-32y+24z+272p+31q-5r+12w-49z+12
Source
2014上海全国邀请赛——题目重现(感谢上海大学提供题目)
#include<stdio.h>char str[12]=" pqruvwxyz";int main(){ int t,a[12],i,flag,j; scanf("%d",&t); while(t--) { flag=0; for(i=1;i<=10;i++) scanf("%d",&a[i]); for(i=1;i<=10;i++) if(a[i]!=0) break; if(i==11) { printf("0\n"); continue; } for(j=i;j<=10;j++) { if(a[j]==0) continue; else if(a[j]==1&&j==10&&j!=i) { printf("+1"); } else if(a[j]==-1&&j==10) { printf("-1"); } else if(a[j]==1&&j==10&&j==i) { printf("1"); } else if(a[j]==-1) printf("-"); else if(a[j]==1&&j!=i) printf("+"); else if(a[j]>0) { if(j!=i) printf("+%d",a[j]); else if(j==i) { if(a[j]!=1) printf("%d",a[j]); } } else if(a[j]<0) { printf("%d",a[j]); } if(j!=10) { printf("%c",str[j]); } } printf("\n"); } return 0;}/*0 0 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0 0 10 0 0 0 0 0 0 0 0 -10 0 0 0 0 0 0 0 0 120 0 0 0 0 0 0 0 0 -121 1 1 1 1 1 1 1 1 11 1 1 1 1 1 1 1 1 01 0 1 0 1 0 1 0 1 00 1 0 1 0 1 0 1 0 10 1 2 3 0 4 5 6 0 71 2 3 4 5 6 7 8 9 10*/
0 0
- hdu 5095模拟
- HDU 5095 (多项式模拟 )
- hdu 5095 多项式模拟+有坑
- 【几何模拟】hdu 3286
- hdu 1020 Encoding(模拟)
- hdu 1303 Doubles(模拟)
- hdu 4020 模拟
- HDU **** 暴力模拟
- HDU 4068 模拟
- HDU 4121 模拟
- 【模拟】HDU 4134
- HDU-1279 模拟
- HDU-1035 模拟
- HDU-1283 简单模拟
- HDU-1263 模拟
- hdu 4140 模拟
- hdu 1034 #模拟
- hdu 4194#模拟
- 末日——《三体》
- C++单件
- python open 的写入读取方式
- iOS 新特性的设置版本配置
- MFC对于win32编程的封装细节
- hdu 5095模拟
- SD卡应用总结(FatFs)
- 迭代遍历Vector、LinkedList、ArrayList三种数据结构
- 字符串替换
- 解决bug小积累
- 积跬步,聚小流-------SQL SEVER对表的基本操作
- 禁止用户访问servlet
- JAVA学习第六十四课 — 反射机制
- HTTP常用状态码