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). 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.
样例:
2
0 46 3 4 -5 -22 -8 -32 24 27 ---> 46q+3r+4u-5v-22w-8x-32y+24z+27
2 31 -5 0 0 12 0 0 -49 12 ---> 2p+31q-5r+12w-49z+12
代码:
char b[15]={'p','q','r','u','v','w','x','y','z'};
int a[15];
int T; int main(){
//freopen("test.in","r",stdin);
cin>>T;
while(T--){
rep(i,0,9) scanf("%d",&a[i]);
int c=-1;
rep(i,0,8) if(a[i]!=0) {c=i; break;}
if(c==-1){
printf("%d\n",a[9]);
continue;
}
if(abs(a[c])==1)
if(a[c]>0) printf("%c",b[c]); else printf("-%c",b[c]);
else
printf("%d%c",a[c],b[c]); ++c;
rep(i,c,8){
if(a[i]==0) continue;
if(abs(a[i])==1)
if(a[i]==1) printf("+%c",b[i]); else printf("-%c",b[i]);
else
if(a[i]>0) printf("+%d%c",a[i],b[i]); else printf("%d%c",a[i],b[i]);
}
if(a[9]!=0){
if(a[9]>0) printf("+%d\n",a[9]); else printf("%d\n",a[9]);
}
else
printf("\n");
}
//fclose(stdin);
}
hdu 5095 Linearization of the kernel functions in SVM(模拟,分类清楚就行)的更多相关文章
- HDU 5095 Linearization of the kernel functions in SVM(模拟)
主题链接:http://acm.hdu.edu.cn/showproblem.php? pid=5095 Problem Description SVM(Support Vector Machine) ...
- 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 ...
- 模拟 HDOJ 5095 Linearization of the kernel functions in SVM
题目传送门 /* 题意:表达式转换 模拟:题目不难,也好理解题意,就是有坑!具体的看测试样例... */ #include <cstdio> #include <algorithm& ...
- Linearization of the kernel functions in SVM(多项式模拟)
Description SVM(Support Vector Machine)is an important classification tool, which has a wide range o ...
- HDU 5095--Linearization of the kernel functions in SVM【模拟】
Linearization of the kernel functions in SVM Time Limit: 2000/1000 MS (Java/Others) Memory Limit: ...
- Kernel Functions for Machine Learning Applications
In recent years, Kernel methods have received major attention, particularly due to the increased pop ...
- SVM Kernel Functions
==================================================================== This article came from here. Th ...
- Kernel Functions-Introduction to SVM Kernel & Examples - DataFlair
Kernel Functions-Introduction to SVM Kernel & Examples - DataFlairhttps://data-flair.training/bl ...
- hdu 5095 多项式模拟+有坑
http://acm.hdu.edu.cn/showproblem.php?pid=5095 就是把ax^2 + by^2 + cy^2 + dxy + eyz + fzx + gx + hy + i ...
随机推荐
- PTA 面向对象程序设计 6-3 面积计算器(函数重载)
6-3 面积计算器(函数重载) 实现一个面积计算器,它能够计算矩形或长方体的面积. 函数接口定义: int area(int x, int y); int area(int x, int y, int ...
- Django学习day03随堂笔记
每日测验 """ 今日考题 1.什么是静态文件,django静态文件配置如何配置,如何解决接口前缀不断变化,html页面上路径的引用需要反复修改的问题 2.request ...
- xml字符串转成数组(php)
1 $str = '<xml> 2 <ToUserName> <![CDATA[gh_fc0a06a20993]]> </ToUserName> 3 & ...
- 如何使用SQL的备份文件(.bak)恢复数据库
出于很多情况,数据库只剩下.bak文件,想要恢复数据库,找了很多资料才知道可以这样!!!!! 个人觉得图片教程更有意义,请看步骤: 1.选中"数据库" 右击 选择"还原数 ...
- php 实现字符串最大子串长度
求字符串最大子串长度<?php class zif { public function sz($str) { $strsz = str_split($str); $zi = []; $len = ...
- [gdoi2018 day1]小学生图论题【分治NTT】
正题 题目大意 一张随机的\(n\)个点的竞赛图,给出它的\(m\)条相互无交简单路径,求这张竞赛图的期望强联通分量个数. \(1\leq n,m\leq 10^5\) 解题思路 先考虑\(m=0\) ...
- P3288-[SCOI2014]方伯伯运椰子【0/1分数规划,负环】
正题 题目链接:https://www.luogu.com.cn/problem/P3288 题目大意 给出\(n\)个点\(m\)条边的一张图,没条边\(i\)流量为\(c_i\),费用是\(d_i ...
- P6624-[省选联考2020A卷]作业题【矩阵树定理,欧拉反演】
正题 题目链接:https://www.luogu.com.cn/problem/P6624 题目大意 \(n\)个点的一张图,每条边有权值,一棵生成树的权值是所有边权和乘上边权的\(gcd\),即 ...
- .NET 5 WPF 调用OCX 经验分享
在.Net 5.0 WPF中调用OCX步骤如下: 1,用工具先把ocx转换成AxInterop.EloamViewLib.dll和Interop.EloamViewLib.dll.(这里是我用到的oc ...
- android 使用SQLite的基本操作
Android操作数据库SQLite使用sql语句基本操作 1:自定义自己的SQLiteOpenHelper public class DBHelper extends SQLiteOpenHelpe ...