Linearization of the kernel functions in SVM

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)

Total Submission(s): 2232    Accepted Submission(s): 598

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.
 
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
2
0 46 3 4 -5 -22 -8 -32 24 27
2 31 -5 0 0 12 0 0 -49 12
 
Sample Output
46q+3r+4u-5v-22w-8x-32y+24z+27
2p+31q-5r+12w-49z+12
 

最烦做的就是模拟题 ,恶心啊。。。

#include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>
#include <stack>
#include <iostream>
using namespace std; char str[] = {'p', 'q', 'r', 'u', 'v', 'w', 'x', 'y', 'z', '\0'};
int a[15]; int main (){
int T;
scanf("%d", &T);
while(T--){
for(int i = 0; i < 10; ++i)
scanf("%d", &a[i]);
int ans = 0;
int flag = 0;
for(int i = 0; i < 9; ++i){ if(a[i] == 0) continue;
if(a[i] == 1 ){
if(flag)
printf("+");
else
flag++;
printf("%c", str[i]);
continue;
}
if(a[i] == -1){
printf("-%c", str[i]);
flag++;
continue;
}
if(a[i] > 0){
if(flag)
printf("+");
else
flag++;
printf("%d%c", a[i], str[i]);
}
else
printf("%d%c", a[i], str[i]), flag++;
}
if(a[9] > 0){
if(flag)
printf("+");
else
flag++;
printf("%d", a[9]);
}
else if( a[9] < 0){
flag ++;
printf("%d", a[9]);
}
if(!flag)
printf("0");
printf("\n");
}
return 0;
}

HDU 5095--Linearization of the kernel functions in SVM【模拟】的更多相关文章

  1. HDU 5095 Linearization of the kernel functions in SVM(模拟)

    主题链接:http://acm.hdu.edu.cn/showproblem.php? pid=5095 Problem Description SVM(Support Vector Machine) ...

  2. HDU 5095 Linearization of the kernel functions in SVM (坑水)

    比较坑的水题,首项前面的符号,-1,+1,只有数字项的时候要输出0. 感受一下这些数据 160 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 ...

  3. hdu 5095 Linearization of the kernel functions in SVM(模拟,分类清楚就行)

    题意: INPUT: The input of the first line is an integer T, which is the number of test data (T<120). ...

  4. 模拟 HDOJ 5095 Linearization of the kernel functions in SVM

    题目传送门 /* 题意:表达式转换 模拟:题目不难,也好理解题意,就是有坑!具体的看测试样例... */ #include <cstdio> #include <algorithm& ...

  5. Linearization of the kernel functions in SVM(多项式模拟)

    Description SVM(Support Vector Machine)is an important classification tool, which has a wide range o ...

  6. Kernel Functions for Machine Learning Applications

    In recent years, Kernel methods have received major attention, particularly due to the increased pop ...

  7. SVM Kernel Functions

    ==================================================================== This article came from here. Th ...

  8. Kernel Functions-Introduction to SVM Kernel & Examples - DataFlair

    Kernel Functions-Introduction to SVM Kernel & Examples - DataFlairhttps://data-flair.training/bl ...

  9. hdu 5095 多项式模拟+有坑

    http://acm.hdu.edu.cn/showproblem.php?pid=5095 就是把ax^2 + by^2 + cy^2 + dxy + eyz + fzx + gx + hy + i ...

随机推荐

  1. [ 高危 ] my存在sql注入

    rank和金币这算RMB为700 这算一个手机端的网站,往往手机端的功能和PC端的功能可能代码写的不一样,接口不一. 登录后,在xxx.maoyan.com/authcenter/wxpay/m?ap ...

  2. Linux系统开发之路 - 下

    5.Ubuntu安装好之后,就可以进行开发环境的搭建.(坚持看完有彩蛋,(>--..--<).jpg). 1)首先安装Nodejs和Npm. 打开浏览器输入nodejs.org,进入页面会 ...

  3. JVM之对象分配:栈上分配 & TLAB分配

    1. Java对象分配流程 2. 栈上分配 2.1 本质:Java虚拟机提供的一项优化技术 2.2 基本思想: 将线程私有的对象打散分配在栈上 2.3 优点: 2.3.1 可以在函数调用结束后自行销毁 ...

  4. Junit4单元测试的基本用法

    看了一些Junit4的视频,简单了解了Junit4的一些基本用法,整理记录一下. 环境搭建 这里使用的开发工具是MyEclipse,首先新建一个Java工程,将Junit4的jar包引入,eclips ...

  5. PHP 操作 MySQL 执行数据库事务

    <?php $mysqli=new mysqli();//实例化mysqli $mysqli->connect('localhost','root','admin','test'); if ...

  6. HOJ3237----BFS/DFS

    /* 注意两点 . 不可以使用替换可用节点为不可用节点的方法进行DFS 因为角落也可能有油,替换了就出不来.(某学长指导) . 可用通过开一个数组(例如我的b[][]数组) 用了存储到当前位置剩余最大 ...

  7. 在用UEditor往后台传数据写入数据库时,出现错误:从客户端(NewsContent="<p><img src="http://...")中检测到有潜在危险的 Request.。。。

    解决办法: 把传数据的方式换了一下,加上 [ValidateInput(false)]就不报错了. 建议看看这个:http://www.360doc.com/content/10/0521/15/46 ...

  8. phpExcel导入大数据量情况下内存溢出解决方案

    PHPExcel版本:1.7.6+ 在不进行特殊设置的情况下,phpExcel将读取的单元格信息保存在内存中,我们可以通过 PHPExcel_Settings::setCacheStorageMeth ...

  9. Node辅助工具NPM&REPL

    Node辅助工具NPM&REPL NPM和REPL是node的包管理器和交互式解析器,可以有效提高开发者效率 NPM npm(Node Package Manager)是node包管理器,完全 ...

  10. JSON.stringify 语法实例讲解 (转)

    原文地址 http://www.jb51.net/article/29893.htm 谢谢 认识javascript也不短的时间了,可是这个用法说实在的,我还是第一次见过,惭愧啊惭愧啊.于是乎,在网上 ...