zoukankan      html  css  js  c++  java
  • fzuoj Problem 2182 水题

    http://acm.fzu.edu.cn/problem.php?pid=2182

    Problem 2182 水题

    Accept: 188    Submit: 277
    Time Limit: 1000 mSec    Memory Limit : 32768 KB

     Problem Description

    胖哥自从当上公务员,赢取白富美,走向人生巅峰后,已经懒散到不想出题了,不仅如此,他连题目都懒得看了,现在他只会根据题目第一个单词的长度判定这个题目的难度

    如果题目的第一个单词太长(长度大于3),他会说这题太难,不可能想的出来; 如果题目的第一个单词太短(长度不大于3),他会说这题太简单,懒得去想

    现在给定一个题目,L想知道胖哥对于这道题会作出什么反应

     Input

    首先是一个正整数cas,表示有cas组输入,cas<=100

    对于每组输入,会给出一行,每行表示一个题目,每个题目只会由大写字母,小写字母或者空格构成,每行的第一个字符一定不会是空格,多个空格可能连续出现,每行最多200个字符

     Output

    对于每个题目,如果胖哥觉得这题太难,输出"Too hard!",否则输出"Too easy!"

     Sample Input

    12
    If the day is done
    If birds sing no more
    If the wind has fiagged tired
    Then draw the veil of darkness thick upon me
    Even as thou hast wrapt the earth with
    The coverlet of sleep and tenderly closed
    The petals of the drooping lotus at dusk
    From the travere
    Whose sack of provisions is empty before the voyage is ended
    Whose garment is torn and dustladen
    Whose strength is exhausted remove shame and poverty
    And renew his life like a flower under
    The cover of thy kindly night

     Sample Output

    Too easy!
    Too easy!
    Too easy!
    Too hard!
    Too hard!
    Too easy!
    Too hard!
    Too hard!
    Too hard!
    Too hard!
    Too easy!
    Too easy!

     Source

    FOJ有奖月赛-2014年11月
     
     
     
    分析:
     
     
    其实就是一个字符串处理的题,关键在输入格式和次数,我只是没有多组数据就wa了一次,巨坑啊~~~
     
     
    AC代码:
     
     1 #include <stdio.h>
     2 #include <algorithm>
     3 #include <iostream>
     4 #include <string.h>
     5 #include <string>
     6 #include <math.h>
     7 #include <stdlib.h>
     8 #include <queue>
     9 #include <stack>
    10 #include <set>
    11 #include <map>
    12 #include <list>
    13 #include <iomanip>
    14 #include <vector>
    15 #pragma comment(linker, "/STACK:1024000000,1024000000")
    16 #pragma warning(disable:4786)
    17 
    18 using namespace std;
    19 
    20 const int INF = 0x3f3f3f3f;
    21 const int MAX = 200 + 10;
    22 const double eps = 1e-8;
    23 const double PI = acos(-1.0);
    24 
    25 char str;
    26 int main()
    27 {
    28     int n;
    29     while(~scanf("%d",&n))
    30     {
    31         getchar();
    32         int i;
    33         for(i = 0;i < n;i ++)
    34         {
    35             int first = 1 , ans = 0;
    36             while(scanf("%c" , &str ) && str != '
    ')
    37             {
    38                 if(str != ' ' && first)
    39                     ans ++;
    40                 else if(str == ' ')
    41                     first = 0;
    42             }
    43             if(ans > 3)
    44                 cout << "Too hard!" << endl;
    45             else
    46                 cout << "Too easy!" << endl;
    47         }
    48     }
    49     return 0;
    50 }
    View Code

    我真二,竟然没有想到用gets(),再来个简单的。

     1 #include<stdio.h>
     2 #include<string.h>
     3 char s[200],a[50];
     4 int main()
     5 {
     6     int n;
     7     scanf("%d",&n);
     8     getchar();
     9     while(n--)
    10     {
    11         scanf("%s",a);
    12         gets(s);
    13         if(strlen(a)>3)
    14              printf("Too hard!
    ");
    15         else
    16              printf("Too easy!
    ");
    17     }
    18     return 0;
    19 } 
    View Code
  • 相关阅读:
    Tcp抓包以及Tcp状态
    Wireshark抓包使用指南
    服务端tcp syn无响应,无回复
    升级openssh
    平滑升级Nginx
    Memcached 未授权访问漏洞修复
    服务端高并发分布式架构演进之路
    es索引查询与删除
    申请elasticsearch中x-pack插件许可证及授权
    独立安装ab压力测试工具及测试nginx性能
  • 原文地址:https://www.cnblogs.com/jeff-wgc/p/4458389.html
Copyright © 2011-2022 走看看