hdoj-2095-Linearization of the kernel functions in SVM
来源:互联网 发布:linux 查看总cpu使用率 编辑:程序博客网 时间:2024/05/17 22:49
Linearization of the kernel functions in SVM
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 2239 Accepted Submission(s): 599
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上海全国邀请赛——题目重现(感谢上海大学提供题目)
Recommend
hujie | We have carefully selected several similar problems for you:5379 5378 5377 5376 5375
主要是好多细节需要考虑:1. 对于第一个输出的正数的正号是否要输出; 2. 系数为 1或 -1的情况;3 . 0的处理(如果系数都为0,要输出最后一位的0)
#include<stdio.h>char s[10]={'p','q','r','u','v','w','x','y','z'};int main(){int t;scanf("%d",&t);while(t--){int a,k=0;for(int i=0;i<9;++i){scanf("%d",&a);if(a==0) continue;//else k++;if(a==1||a==-1) {if(a==1&&k) printf("+");//else if(a==1&&k==0) ;else if(a==-1)printf("-");printf("%c",s[i]); k++;continue;}if(a>0&&k) printf("+");printf("%d",a);printf("%c",s[i]);k++;}scanf("%d",&a); if(a==1||a==-1) {if(a==1&&k==0) printf("1");else if(a==1&&k) printf("+1");else if(a==-1)printf("-1");printf("\n");//continue;}else {if(a==0){if(k==0) printf("0\n");else printf("\n");continue;}if(a>0&&k) printf("+");printf("%d",a);printf("\n");}}return 0;}
0 0
- hdoj-2095-Linearization of the kernel functions in SVM
- 【杂题】 HDOJ 5095 Linearization of the kernel functions in SVM
- HDOJ 5095 Linearization of the kernel functions in SVM 坑题
- hdoj 5095 Linearization of the kernel functions in SVM 【模拟】
- Linearization of the kernel functions in SVM
- Linearization of the kernel functions in SVM
- 【瞎搞】 HDU 5095 Linearization of the kernel functions in SVM
- hdu 5095 Linearization of the kernel functions in SVM(模拟)
- hdu 5095 Linearization of the kernel functions in SVM(水题)
- HDU5095 Linearization of the kernel functions in SVM(模拟)
- HDU 5095 - Linearization of the kernel functions in SVM
- HDU 5095--Linearization of the kernel functions in SVM【模拟】
- HDU 5095 Linearization of the kernel functions in SVM【模拟】
- HDU 5095 Linearization of the kernel functions in SVM
- HDU 5095 Linearization of the kernel functions in SVM
- HDU 5095 Linearization of the kernel functions in SVM(模拟)
- HDU 5095Linearization of the kernel functions in SVM(水题)
- HDU 5095 Linearization of the kernel functions in SVM(模拟, 水题)
- 如何查询被锁定表及如何解锁释放session
- windows下配置sklearn
- 利用Java正则表达式验证手机号、邮箱等
- C专家编程—分析signal函数的原型声明{void (*signal(int sig,void (*func)(int)))(int)}(2)
- hdoj 畅通工程再续prim
- hdoj-2095-Linearization of the kernel functions in SVM
- WebRtc libjingle_PeerConnection层(一) 显示本地视频
- MySQL数据库迁移(直接复制文件)
- POI 读写Excel
- cocos studio 将界面生成json 文件
- Python获取本机外网IP
- python循环遍历文件操作
- Angular ui-grid 2.0 与 3.0 版本区别
- ArcMap常用工具