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 ...
随机推荐
- 洛谷P1125——笨小猴(简易模拟)
https://www.luogu.org/problem/show?pid=1125 题目描述 笨小猴的词汇量很小,所以每次做英语选择题的时候都很头疼.但是他找到了一种方法,经试验证明,用这种方法去 ...
- Linux系列(15) - man
简介 查看命令帮助,是个帮助命令 格式 man [选项] 命令 选项 -f:相当于 whatis 命令,查询一个命令执行什么功能,这个命令是什么级别的,并将查询结果打印到终端 -k:相当于 aprop ...
- PHP统计当前网站的访问人数,访问信息,被多少次访问。
<?php header('Content-type:text/html;charset=utf-8'); //统计流量(人数,访问次数,用户IP) //假设用户访问,得到IP地址 $remo ...
- 『GoLang』包
可见性规则 在Go语言中,标识符必须以一个大写字母开头,这样才可以被外部包的代码所使用,这被称为导出.标识符如果以小写字母开头,则对包外是不可见的,但是他们在整个包的内部是可见并且可用的.但是包名不管 ...
- re.findall用法
其中,re.findall() 函数可以遍历匹配,可以获取字符串中所有匹配的字符串,返回一个列表. 在python源代码中,展示如下: 搜索string,返回一个顺序访问每一个匹配结果(Match对象 ...
- Python语句,表达式的区别?
参考了网上的文章,说 表达式的结果是值,对象 比如1+2, 是表达式 具体根据运算符不同有算术,逻辑,比较等等类型的表达式 语句是控制程序走向,不产生值 例如if/else等 参考: https:// ...
- CF235D-Graph Game【LCA,数学期望】
正题 题目链接:https://www.luogu.com.cn/problem/CF235D 题目大意 给出一棵基环树,每次随机选择一个点让权值加上这个点的连通块大小然后删掉这个点. 求删光所有点时 ...
- Jmeter压测学习1—第一个项目:登录
我用的是我们公司的测试环境练习的 网址:http://****:9000/login.html 账号是admin 密码:123456 一.打开Jmeter 找到安装目录:bin->Jmeter ...
- python paramiko实现ssh上传下载执行命令
paramiko ssh上传下载执行命令 序言 最近项目经常需要动态在跳板机上登录服务器进行部署环境,且服务器比较多,每次完成所有服务器到环境部署执行耗费大量时间.为了解决这个问题,根据所学的执行实现 ...
- python 包(package)和模块(module)的创建和引入(import)
python 包(package)和模块(module)的创建和引入(import) 名词解释 实际上,Python中的函数(Function).类(Class).模块(Module).包库(Pack ...