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 ...
随机推荐
- open failed: EACCES (Permission denied)
出现背景:调用系统相册进行图片展示,但是没有成功,是空白的,且检查权限无问题 解决方法
- SVN与LDAP服务器整合验证
说明:svn的访问是以svn://协议访问的,一般都是用http协议访问,所以要使用apache的httpd服务器apache已经添加了对ldap服务器的支持,所以svn的认证过程是使用apache代 ...
- P7444-「EZEC-7」猜排列【dp】
正题 题目链接:https://www.luogu.com.cn/problem/P7444 题目大意 一个长度为\(n\)的排列,已知每个\(c_i\)表示那个排列中\(mex\)为\(i\)的区间 ...
- EasyExcel无法用转换器或者注解将java字段写入为excel的数值格式
需求: 在用easyExcel导出报表时,碰到需要将数据转换为数值or货币格式的需求 过程: 1.首先采取转换器的形式 @Override public CellData convertToExcel ...
- C++ 可变数组实现
话不多说,直接上代码,看注释 template<class T> // 支持传入泛型,但string这种可变长度的类型还不支持 class Array { int mSize = 0, m ...
- 从0到1使用Kubernetes系列——Kubernetes入门
基本概念 Docker 是什么 Docker 起初是 dotCloud 公司创始人 Solomon Hykes 在法国的时候发起的一项公司内部项目,Docker 是基于 dotCloud 公司多年云服 ...
- 对于caffe程序中出现的Unknown database backend问题的报错怎么办?
在预处理器中添加USE_LMDB,因为caffe需要一种数据输入格式 这样,在db.cpp中#ifdef USE_LMDB就会变亮,显示使用的数据格式为LMDB
- 我们携手啦 | SphereEx 正式加入 openGauss 社区
近日,SphereEx 签署 CLA ( Contribution License Agreement,贡献许可协议),正式加入 openGauss 社区. SphereEx 和 openGauss ...
- 从0到1使用Kubernetes系列(二):安装工具介绍
该系列第一篇为:<从0到1使用Kubernetes系列--Kubernetes入门>.本文是Kubernetes系列的第二篇,将介绍使用Kubeadm+Ansible搭建Kubernete ...
- Java(25)常见异常整理
作者:季沐测试笔记 原文地址:https://www.cnblogs.com/testero/p/15228418.html 博客主页:https://www.cnblogs.com/testero ...