模拟 HDOJ 5095 Linearization of the kernel functions in SVM

题目传送门

  1 /*
  2     题意:表达式转换
  3     模拟:题目不难,也好理解题意,就是有坑!具体的看测试样例。。。
  4 */
  5 #include <cstdio>
  6 #include <algorithm>
  7 #include <iostream>
  8 #include <cstring>
  9 #include <cmath>
 10 #include <string>
 11 #include <vector>
 12 #include <queue>
 13 #include <map>
 14 #include <set>
 15 #include <ctime>
 16 #include <cstdlib>
 17 using namespace std;
 18
 19 const int MAXN = 1e4 + 10;
 20 const int INF = 0x3f3f3f3f;
 21
 22 char s[] = {‘p‘, ‘q‘, ‘r‘, ‘u‘, ‘v‘, ‘w‘, ‘x‘, ‘y‘, ‘z‘};
 23
 24 int main(void)        //HDOJ 5095 Linearization of the kernel functions in SVM
 25 {
 26     //freopen ("F.in", "r", stdin);
 27
 28     int t;    scanf ("%d", &t);
 29     while (t--)
 30     {
 31         int a[11];    bool first = false;    int j = -1;
 32         for (int i=1; i<=10; ++i)    scanf ("%d", &a[i]);
 33         for (int i=1; i<=10; ++i)
 34         {
 35             j++;
 36             if (!a[i])    continue;
 37             if (a[i] > 0 && first)    putchar (‘+‘);
 38
 39             if (a[i] == -1)
 40             {
 41                 if (i < 10)    putchar (‘-‘);
 42                 else    printf ("-1");
 43             }
 44             else
 45             {
 46                 if (a[i] == 1)
 47                 {
 48                     if (i == 10)    putchar (‘1‘);
 49                 }
 50                 else printf ("%d", a[i]);
 51             }
 52
 53             first = true;
 54             if (j <= 8)    printf ("%c", s[j]);
 55         }
 56         if (!first)    printf ("0");
 57         puts ("");
 58     }
 59
 60     return 0;
 61 }
 62
 63 /*
 64 21
 65 0 46 3 4 -5 -22 -8 -32 24 27
 66 2 31 -5 0 0 12 0 0 -49 12
 67 0 1 0 0 0 0 0 0 0 -1
 68 0 0 0 0 0 0 0 0 0 0
 69 0 0 0 0 0 0 0 0 0 1
 70 1 -1 1 -1 1 1 1 1 1 0
 71 0 46 3 4 -5 -22 -8 -32 24 27
 72 2 31 -5 0 0 12 0 0 -49 12
 73 0 0 0 0 0 0 0 0 0 0
 74 1 2 3 4 5 6 7 8 9 10
 75 -1 2 3 -5 8 3 0 6 9 20
 76 1 -1 1 1 1 -1 -1 -1 0 0
 77 10000 123 123 123 456 12354 123 12345  45 10110
 78 0 0 0 1 2 3 -1 -2 -3 56
 79 0 0 0 -1 -2 0 0 1 23 45
 80 */
 81
 82 /*
 83 46q+3r+4u-5v-22w-8x-32y+24z+27
 84 2p+31q-5r+12w-49z+12
 85 q-1
 86 0
 87 1
 88 p-q+r-u+v+w+x+y+z
 89 46q+3r+4u-5v-22w-8x-32y+24z+27
 90 2p+31q-5r+12w-49z+12
 91 0
 92 p+2q+3r+4u+5v+6w+7x+8y+9z+10
 93 -p+2q+3r-5u+8v+3w+6y+9z+20
 94 p-q+r+u+v-w-x-y
 95 10000p+123q+123r+123u+456v+12354w+123x+12345y+45z+10110
 96 u+2v+3w-x-2y-3z+56
 97 -u-2v+y+23z+45
 98 -u-2v+y+23z+45
 99 -u-2v+y+23z+45
100 -u-2v+y+23z+45
101 -u-2v+y+23z+45
102 -u-2v+y+23z+45
103 -u-2v+y+23z+45
104 */
时间: 2024-11-07 15:10:24

模拟 HDOJ 5095 Linearization of the kernel functions in SVM的相关文章

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: 65536/65536 K (Java/Others) Total Submission(s): 206    Accepted Submission(s): 109 Problem Description SVM(Support Vector Machine)is an important cl

HDU 5095 Linearization of the kernel functions in SVM(模拟)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5095 Problem Description SVM(Support Vector Machine)is an important classification tool, which has a wide range of applications in cluster analysis, community division and so on. SVM The kernel functions

hdu 5095 Linearization of the kernel functions in SVM 坑多的水题 细节

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5095 几个坑 系数为正负1是不输出系数(比赛时wa到死) 0时不输出但全零时要输出0 加号和减号的控制 #include <cstring> #include <cstdlib> #include <cstring> #include <cmath> #include <algorithm> #include <iostream> #in

HDU5095——水过——Linearization of the kernel functions in SVM

Problem Description SVM(Support Vector Machine)is an important classification tool, which has a wide range of applications in cluster analysis, community division and so on. SVM The kernel functions used in SVM have many forms. Here we only discuss t

hdoj-2095-Linearization of the kernel functions in SVM

Linearization of the kernel functions in SVM Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 2239 Accepted Submission(s): 599 Problem Description SVM(Support Vector Machine)is an important classif

hdu---5095---Linearization of the kernel functions in SVM

http://acm.hdu.edu.cn/showproblem.php?pid=5095 分析:当a[i]不为0的时候,就有输出; 输出内容:1.系数为正数且不是第一个位置输出一个'+'; 2.当系数为-1时且不是最后一个常数时输出一个'-'; 3.系数不是-1或1或者是最后那个常数时输出这个数: 4.最后一个位置没有字符要输出. Problem Description SVM(Support Vector Machine)is an important classification too

模拟 HDOJ 4552 Running Rabbits

题目传送门 1 /* 2 模拟:看懂题意,主要是碰壁后的转向,笔误2次 3 */ 4 #include <cstdio> 5 #include <algorithm> 6 #include <cstring> 7 #include <vector> 8 using namespace std; 9 10 const int MAXN = 1e3 + 10; 11 const int INF = 0x3f3f3f3f; 12 struct Rabbit 13

模拟 HDOJ 5387 Clock

题目传送门 1 /* 2 模拟:这题没啥好说的,把指针转成角度处理就行了,有两个注意点:结果化简且在0~180内:小时13点以后和1以后是一样的(24小时) 3 模拟题伤不起!计算公式在代码内(格式:hh/120, mm/120, ss/120) 4 */ 5 /************************************************ 6 * Author :Running_Time 7 * Created Time :2015-8-13 13:04:31 8 * Fil

模拟 HDOJ 5099 Comparison of Android versions

题目传送门 1 /* 2 题意:比较型号的大小 3 模拟:坑点在长度可能为5,此时设为'A' 4 */ 5 #include <cstdio> 6 #include <algorithm> 7 #include <iostream> 8 #include <cstring> 9 #include <cmath> 10 #include <string> 11 #include <vector> 12 #include &l