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 ...
随机推荐
- 一文彻底搞懂Hive的数据存储与压缩
目录 行存储与列存储 行存储的特点 列存储的特点 常见的数据格式 TextFile SequenceFile RCfile ORCfile 格式 数据访问 Parquet 测试 准备测试数据 存储空间 ...
- 一文梳理清楚mysql各种锁
全局锁: 1.FTWRL(读锁) 用于做全库的逻辑备份 加锁:FLUSH TABLES WITH READ LOCK 解锁:unlock tables 表级锁: 1.表锁 表锁的读锁和写锁 加锁:lo ...
- (转载)深入理解MDL元数据锁
作者:MySQL技术本文为作者原创,转载请注明出处:https://www.cnblogs.com/kunjian/p/11993708.html 前言: 当你在MySQL中执行一条SQL时,语句并没 ...
- python杀死Windows后台程序
检测 "sogou-gui.exe" 的进程可用tasklist命令 tasklist /FI "IMAGENAME eq sogou-gui.exe" FI: ...
- css 样式设定
阴影: --可以同时设定多个阴影.用逗号隔开 http://www.fly63.com/article/detial/4726 div { box-shadow: 10px 10px 5px #888 ...
- 浅聊Linux的五种IO模型
在日常 Coding 中,多多少少都会接触到网络 IO,就会想要深入了解一下.看了很多文章,总是云里雾里的感觉,直到读了<UNIX网络编程 卷1:套接字联网API>中的介绍后,才豁然开朗. ...
- P7444-「EZEC-7」猜排列【dp】
正题 题目链接:https://www.luogu.com.cn/problem/P7444 题目大意 一个长度为\(n\)的排列,已知每个\(c_i\)表示那个排列中\(mex\)为\(i\)的区间 ...
- CF643F-Bears and Juice【组合数学】
正题 题目链接:https://www.luogu.com.cn/problem/CF643F 题目大意 题目有点奇怪就直接放翻译了 有 \(n\) 只熊和若干桶果汁和恰好一桶酒,每一天每只熊会选择一 ...
- vue项目中的element-ui地区级联选择器加详细地址push到对象中不显示的问题
想要实现级联选择器el-cascader和输入框el-input共同组成的详细地址,添加数据时弹出el-drawer嵌套el-form弹窗,然后在el-form添加数据提交后push到el-table ...
- Incorrect datetime value: 时间添加失败原因
在进行单元测试中通过 new Date() 方式添加时间时,报了 Data truncation: Incorrect datetime value:这样的错误(我数据库表的时间类型是 datetim ...