博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
HDU 5095 Linearization of the kernel functions in SVM(模拟)
阅读量:6271 次
发布时间:2019-06-22

本文共 3358 字,大约阅读时间需要 11 分钟。

主题链接:

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 + cz^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 + cz^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 + cz^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
 

Source
 

Recommend
hujie   |   We have carefully selected several similar problems for you:            

PS:

一道比較坑的模拟题。

注意1和-1 的情况。

代码例如以下:

#include 
#include
#include
#include
using namespace std;int main(){ int M; int a[17]; char b[17] = {'#','p','q','r','u','v','w','x','y','z'}; scanf("%d",&M); getchar(); while(M--) { for(int k = 1; k <= 10; k++) { scanf("%d",&a[k]); } int cont = 0; int flag = 0; for(int k = 1; k < 10; k++) { if(a[k]==0) continue; cont++; if(cont == 1) { if(a[k] != 1 && a[k] != -1) printf("%d%c",a[k],b[k]); else if(a[k] == 1) printf("%c",b[k]); else if(a[k] == -1) printf("-%c",b[k]); flag = 1; } else { if(a[k] > 0) printf("+"); if(a[k] != 1 && a[k] != -1) printf("%d%c",a[k],b[k]); else if(a[k] == 1) printf("%c",b[k]); else if(a[k] == -1) printf("-%c",b[k]); flag = 1; } } if(a[10]) { if(a[10] > 0 && flag) printf("+"); printf("%d",a[10]); flag = 1; } if(!flag)//没有答案 printf("0"); printf("\n"); } return 0;}/*990 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 01 0 0 0 0 0 0 0 0 0-1 0 0 0 0 0 0 0 0 0-1 -1 -1 -41 -1 -1 -1 -1 -1 -1-1 5 -2 0 0 0 0 0 0 01 1 1 1 1 1 1 1 1 1-1 -1 -1 -1 -1 -1 -1 -1 -1 -10 0 0 0 0 -1 -1 -1 -1 -10 0 0 0 0 1 1 1 1 11 1 1 1 1 0 0 0 0 0-1 -1 -1 -1 -1 0 0 0 0 01 1 1 1 1 1 1 1 1 0*/


版权声明:本文博客原创文章。博客,未经同意,不得转载

本文转自mfrbuaa博客园博客,原文链接:http://www.cnblogs.com/mfrbuaa/p/4723404.html,如需转载请自行联系原作者

你可能感兴趣的文章
zinnia项目功能分析
查看>>
windows cmd for paramiko
查看>>
SQL经典面试题集锦
查看>>
View学习(一)-DecorView,measureSpec与LayoutParams
查看>>
色彩力量!21款你应该知道的优秀品牌设计
查看>>
SDUT 3503 有两个正整数,求N!的K进制的位数
查看>>
【.Net】C# 根据绝对路径获取 带后缀文件名、后缀名、文件名、不带文件名的文件路径...
查看>>
Redis常用命令速查 <第二篇>
查看>>
CSS规范
查看>>
使用FastDateFormat来代替JDK自带的DateFormat
查看>>
Python爬虫从入门到放弃(十六)之 Scrapy框架中Item Pipeline用法
查看>>
Android源代码解析之(三)--&gt;异步任务AsyncTask
查看>>
(zhuan) 自然语言处理中的Attention Model:是什么及为什么
查看>>
C#中使用RabbitMQ收发队列消息
查看>>
Hadoop1.2.1 全然分布式集群搭建实操笔记
查看>>
第三百二十七节,web爬虫讲解2—urllib库爬虫—基础使用—超时设置—自动模拟http请求...
查看>>
MVC总结--MVC简单介绍以及和WebForm差别
查看>>
tiny4412 裸机程序 五、控制icache【转】
查看>>
VB.NET多线程入门
查看>>
国外物联网平台初探(二) ——微软Azure IoT
查看>>