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 ...
随机推荐
- Android使用Fragment+ViewPager +TabLayout实现顶部标题栏
参考资料: https://blog.csdn.net/Tobey_r1/article/details/93221486 项目背景是Android开发新闻APP,实现新闻文本的分类,内容的展示,并实 ...
- 安卓学习记录(五)——体温表APP.2
一.项目结构 二.源码 1.数据层 db+dao+bean package com.example.tem.db; import android.content.Context; import and ...
- 一文详解JavaScript的继承模式
1 原型链继承 #### ES6中通过原型继承多个引用类型的属性和方法,由于原型和实例的关系,即每个构造函数都有自己的原型对象,同时原型有一个属性指向构造函数,并且实例有一个内部的指针指向原型.如果存 ...
- 在PHP中如何为匿名函数指定this?
在之前的文章中,我们已经学习过匿名函数的使用,没有看过的小伙伴可以进入传送门先去了解下闭包匿名函数的用法,传送:还不知道PHP有闭包?那你真OUT了. 关于闭包匿名函数,在JS中有个很典型的问题就是要 ...
- JS验证监听输入银行卡号
$("#AccountNum").keydown(function(e) { if(!isNaN(this.value.replace(/[ ]/g,""))) ...
- nginx 添加ssl证书
第一步: 获取linux的证书格式 .crt .key 第二步: 在nginx中default.conf中再添加一个server 第三步: 内容举例如下: server { #这里开始 liste ...
- css 常用语法
1.禁止某个元素内的任何选中操作: .classname{ -webkit-user-select: none; -moz-user-select: none; -ms-user-select: no ...
- Phalcon如何切换数据库《Phalcon入坑指南系列 三》
本系列目录 一.Phalcon在Windows上安装 <Phalcon入坑指南系列 一> 二.Phalcon入坑必须知道的功能(项目配置.控制器.模型.增.删.改.查) 三.Phalcon ...
- P6800-[模板]Chirp Z-Transform【NTT】
正题 题目链接:https://www.luogu.com.cn/problem/P6800 题目大意 给出一个\(n\)此多项式\(P\),对于\(k\in[0,m-1]\)所有的求\(P(c^k) ...
- 什么?你还不明白自动化的POM设计模式?
POM简介.POM优势.如何设计POM POM简介 Page Object Model (POM) 直译为"页面对象模型",这种设计模式旨在为每个待测试的页面创建一个页面对象(cl ...