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. shiro学习总结(一)----初识shiro

    本系列内容大多总结自官网和张开涛的<跟我学Shiro> 一.shiro简介 1.1.shiro有什么用? shiro是一个功能强大使用简单的java安全框架,主要提供了五大功能: 1.认证 ...

  2. Cisco 12系列 AP 初始化配置-1-安装IOS

    12系列AP虽然已经淘汰了,但是像我们这种没钱的公司用了10年却还是在用,好在它还有学习的价值,还是可以从12系列AP看出一些思科部署无线的思路吧. 首先吐槽一下国内常说的胖.瘦AP的这种说法,因为用 ...

  3. Python datetime与timestamp之间的转换

    # !!!! Python 2 datetime.datetime 对象没有timestamp方法! 在用Python处理datetime和timestamp的转换时发现在时区方面,Python的处理 ...

  4. mysql复习

    1.数据库操作 CREATE DATABASE 数据库名 charset utf8; 查看数据库 show databases; show create database db1; select da ...

  5. MySql修改数据表的基本操作(DDL操作)

    1.查看表基本结构语句: DESC 表名 2,查看表详细结构语句:show create table 表名 3.修改表名:alter table 旧表名 rename to 新表名 4.修改字段的数据 ...

  6. BZOJ4963 : String

    用SAM支持往末尾在线添加字符的功能. 设$f[i][j]$表示右端点为i的每个左端点的答案,那么当$i$变为$i+1$时,在SAM的parent链形成的树中会新增一个叶子$p$. 对于每个节点,维护 ...

  7. linux重新设置密码,亲试成功

    1:进入/etc/my.cnf 在[mysqld]下添加一行skip-grant-tables 2:保存配置文件后,输入whereis systemctl(提示redirecting to 某个目录下 ...

  8. django之模板继承以和模板导入

    1,模板继承 一,模板继承 1.在template下面新建一个master.html的文件,当做母版. 2. 母版里需要被替代的部分,以block开始,以endblock结尾 {% block con ...

  9. JDBC(14)—对DAO进行改进修改

    结构: DAO2_7< T >(接口)->DAOTestImpl< T >(实现类)->CustomerDAO(继承的子类)->CustomerDAOTest ...

  10. Multiple Tasks Z

    public static async Task executeParallel<T>(this IEnumerable<T> items, int limit, Func&l ...