zoukankan      html  css  js  c++  java
  • 模拟 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 */
    编译人生,运行世界!
  • 相关阅读:
    读书笔记之:Accelerated C++ 中文版[+]
    读书笔记之:C程序设计语言(第2版)[+++++]
    读书笔记之:C++精解与程序设计[]
    C/C++中的输入与输出及如何读取一行文本
    C/C++中的getline函数总结
    JM中的一些问题总结
    YUV主要采样格式理解
    读书笔记之:C++ Primer (第4版)及习题(ch12ch18) [++++]
    读书笔记之:C++ Primer (第4版)及习题(ch01ch11) [++++]
    读书笔记之:C++精髓·软件工程[]
  • 原文地址:https://www.cnblogs.com/Running-Time/p/4514897.html
Copyright © 2011-2022 走看看