HDU 5095 Linearization of the kernel functions in SVM(模拟)
主题链接:http://acm.hdu.edu.cn/showproblem.php?
pid=5095
= ax^2 + by^2 + cz^2 + dxy + eyz + fzx + gx + hy + iz + j. By introducing new variables p, q, r, u, v, w, the linearization of the function f(x,y,z) is realized by setting the correspondence x^2 <-> p, y^2 <-> q, z^2 <-> r,
xy <-> u, yz <-> v, zx <-> w and the function f(x,y,z) = ax^2 + by^2 + cz^2 + dxy + eyz + fzx + gx + hy + iz + j can be written as g(p,q,r,u,v,w,x,y,z) = ap + bq + cr + du + ev + fw + gx + hy + iz + j, which
is a linear function with 9 variables.
Now your task is to write a program to change f into g.
= ax^2 + by^2 + cz^2 + dxy + eyz + fzx + gx + hy + iz + j.
2
0 46 3 4 -5 -22 -8 -32 24 27
2 31 -5 0 0 12 0 0 -49 12
46q+3r+4u-5v-22w-8x-32y+24z+27
2p+31q-5r+12w-49z+12
pid=5098" style="color:rgb(26,92,200); text-decoration:none">5098
pid=5097" style="color:rgb(26,92,200); text-decoration:none">5097
5096pid=5094" style="color:rgb(26,92,200); text-decoration:none">5094
5093PS:
一道比較坑的模拟题。
注意1和-1 的情况。
代码例如以下:
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
using namespace std;
int main()
{
int M;
int a[17];
char b[17] = {'#','p','q','r','u','v','w','x','y','z'};
scanf("%d",&M);
getchar();
while(M--)
{
for(int k = 1; k <= 10; k++)
{
scanf("%d",&a[k]);
}
int cont = 0;
int flag = 0;
for(int k = 1; k < 10; k++)
{
if(a[k]==0)
continue;
cont++;
if(cont == 1)
{
if(a[k] != 1 && a[k] != -1)
printf("%d%c",a[k],b[k]);
else if(a[k] == 1)
printf("%c",b[k]);
else if(a[k] == -1)
printf("-%c",b[k]);
flag = 1;
}
else
{
if(a[k] > 0)
printf("+");
if(a[k] != 1 && a[k] != -1)
printf("%d%c",a[k],b[k]);
else if(a[k] == 1)
printf("%c",b[k]);
else if(a[k] == -1)
printf("-%c",b[k]);
flag = 1;
}
}
if(a[10])
{
if(a[10] > 0 && flag)
printf("+");
printf("%d",a[10]);
flag = 1;
}
if(!flag)//没有答案
printf("0");
printf("\n");
}
return 0;
}
/*
99
0 0 0 0 0 0 0 0 0 -1
0 0 0 0 0 0 0 0 0 1
0 0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0 0
-1 0 0 0 0 0 0 0 0 0
-1 -1 -1 -41 -1 -1 -1 -1 -1 -1
-1 5 -2 0 0 0 0 0 0 0
1 1 1 1 1 1 1 1 1 1
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1
0 0 0 0 0 -1 -1 -1 -1 -1
0 0 0 0 0 1 1 1 1 1
1 1 1 1 1 0 0 0 0 0
-1 -1 -1 -1 -1 0 0 0 0 0
1 1 1 1 1 1 1 1 1 0
*/
版权声明:本文博客原创文章。博客,未经同意,不得转载。
HDU 5095 Linearization of the kernel functions in SVM(模拟)的更多相关文章
- 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 ...
- 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). ...
- 模拟 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 ...
随机推荐
- HDu 2830 Matrix Swapping II(dp)
Problem Description Given an N * M matrix with each entry equal to 0 or 1. We can find some rectangl ...
- .Net 内存溢出(System.OutOfMemoryException)
.Net 内存溢出(System.OutOfMemoryException) 在什么情况下会出现OutOfMemonryException呢? 在我们试图新建一个对象时,而垃圾收集器又找不到任何可用内 ...
- C的xml编程文章链接
官方地址:http://www.xmlsoft.org/ http://hi.baidu.com/singyea/item/ed4d1c335a9527b8633aff82 http://os.chi ...
- css 背景色渐变
background:rgba(0, 0, 0, 0) linear-gradient(to bottom, #eff5ff 0px, #e0ecff 20%) repeat-x scroll 0 0 ...
- 2012天津C题
行李箱上的密码锁大家都知道, 现在给我们长度为n(n<=1000)的两个密码串,每次可以转动连续的1->3个字符1格,问最少多少次可以使得第一个串变成第二个串 经历了搜索,贪心,的思路后, ...
- [Windows]_[0基础]_[使用命令行工具dumpbin分析文件]
dumpbin(vs拥有) 1. 出口lib函数符号文件(symbols) dumpbin /exports zlib1.lib Microsoft (R) COFF/PE Dumper Versio ...
- 华为-on练习--小写字符数的统计显示
主题: 手动输入一个字符串,只有小写字母,统计每个字符和输出频率中出现的串,输出.提示可以使用map 样例:输入:aaabbbccc 输出:a 3 b 3 c 3 分析: 看到后面的提示,简直就是不用 ...
- MIT 操作系统实验 MIT JOS lab2
MIT JOS lab2 首先把内存分布理清楚,由/boot/main.c可知这里把kernel的img的ELF header读入到物理地址0x10000处 这里能够回想JOS lab1的一个小问.当 ...
- [笔记] C# Windows Phone 8 WP8 开发,判断目前网路是否可用。
原文:[笔记] C# Windows Phone 8 WP8 开发,判断目前网路是否可用. 常常我们在开发Windows Phone 8 App时会使用网路来读取网页的资料或其他开放平台的Json.X ...
- wcf和webservice区别
1.WebService:严格来说是行业标准,不是技术,使用XML扩展标记语言来表示数据(这个是夸语言和平台的关键).微软的Web服务实现称为ASP.NET Web Service.它使用Soap简单 ...