Sdut 2411 -- pixel density simulation details wa n times

Source: Internet
Author: User

URL: http://acm.sdut.edu.cn/sdutoj/problem.php? Action = showproblem & problemid = 2411

The third ACM competition in Shandong province.

Note:

1. There can be no decimal point. You can use the decimal point and star number as separators to save the time.

2. There are not a few spaces. It is quite troublesome to use getline (). It is better to manually enter a string array.

3. inches is not the only separator. The phone name can contain the inches character, so the find_last_of ("inches") (I didn't use this method)

4. Pay attention to the result of 0.00.

5. If there are N spaces in the phone name, a space is output.

# Include <cstdlib> # include <iostream> # include <cstdio> # include <cmath> # include <cstring> # include <algorithm> # include <set> # include <map> # include <list> # include <queue> # include <vector> # define ll long # define INF 0x7fffffff # define e 1e-11 # define M 100 # define n 1000 using namespace STD; int m, n, T; char STR [N] [N]; int OK (char * Str) {If (strcmp (STR, "inches") = 0) return 1; return 0;} int main () {# ifndef online_judge F Reopen ("ex. in "," r ", stdin); # endif scanf (" % d % * C ", & T); int ncase = 0; while (t --) {double D; int n = 0; int sub; while (scanf ("% s", STR [N])! = EOF) {If (OK (STR [N]) {sub = N; // cannot exit} n ++; char c = getchar (); if (C = '\ n') break;} double A, B; sscanf (STR [sub + 1], "% lf * % lf", &, & B); sscanf (STR [Sub-1], "% lf", & D); For (INT I = sub + 2; I <n; I ++) for (Int J = 0; STR [I] [J]; j ++) STR [I] [J] = tolower (STR [I] [J]); printf ("case % d: the", ++ ncase); For (INT I = sub + 2; I <n; I ++) printf ("% s ", STR [I]); printf ("of"); For (INT I = 0; I <sub-1; ++ I) printf ("% s ", STR [I]); If (FABS (d) <E) // wa printf ("s PPI is %. 2lf. \ n ", 0.00); else printf ("'s PPI is %. 2lf. \ n ", SQRT (A * A + B * B)/d);} return 0 ;}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.