- a
欢迎来 CFOJ CF(
- 2023-4-27 21:10:19 @
搬完我做的题后发现我只做了 47 题……
6 comments
-
C20250005 @ 2023-5-19 10:35:46
dwsd
-
2023-5-8 15:45:16@
// Standard iostream objects -*- C++ -*- // Copyright (C) 1997-2014 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the // terms of the GNU General Public License as published by the // Free Software Foundation; either version 3, or (at your option) // any later version. // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file include/iostream * This is a Standard C++ Library header. */ // // ISO C++ 14882: 27.3 Standard iostream objects // #ifndef _GLIBCXX_IOSTREAM #define _GLIBCXX_IOSTREAM 1 #pragma GCC system_header #include <bits/c++config.h> #include <ostream> #include <istream> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * @name Standard Stream Objects * * The <iostream> header declares the eight <em>standard stream * objects</em>. For other declarations, see * http://gcc.gnu.org/onlinedocs/libstdc++/manual/io.html * and the @link iosfwd I/O forward declarations @endlink * * They are required by default to cooperate with the global C * library's @c FILE streams, and to be available during program * startup and termination. For more information, see the section of the * manual linked to above. */ //@{ extern istream cin; /// Linked to standard input extern ostream cout; /// Linked to standard output extern ostream cerr; /// Linked to standard error (unbuffered) extern ostream clog; /// Linked to standard error (buffered) #ifdef _GLIBCXX_USE_WCHAR_T extern wistream wcin; /// Linked to standard input extern wostream wcout; /// Linked to standard output extern wostream wcerr; /// Linked to standard error (unbuffered) extern wostream wclog; /// Linked to standard error (buffered) #endif //@} // For construction of filebuffers for cout, cin, cerr, clog et. al. static ios_base::Init __ioinit; _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif /* _GLIBCXX_IOSTREAM */
-
2023-5-6 15:06:09@
😕
-
2023-5-6 11:25:02@
You are playing with a really long strip consisting of white cells, numbered from left to right as , , and so on. You are controlling a special pointer that is initially in cell . Also, you have a "Shift" button you can press and hold. In one move, you can do one of three actions: move the pointer to the right (from cell to cell ); press and hold the "Shift" button; release the "Shift" button: the moment you release "Shift", all cells that were visited while "Shift" was pressed are colored in black. (Of course, you can't press Shift if you already hold it. Similarly, you can't release Shift if you haven't pressed it.) Your goal is to color at least cells, but there is a restriction: you are given segments — you can color cells only inside these segments, i. e. you can color the cell if and only if for some . What is the minimum number of moves you need to make in order to color at least cells black? The first line contains a single integer () — the number of test cases. The first line of each test case contains two integers and (; ) — the number of segments and the desired number of black cells, respectively. The second line contains integers (), where is the left border of the -th segment. The third line contains integers (; ), where is the right border of the -th segment. Additional constraints on the input: every cell belongs to at most one segment; the sum of doesn't exceed . For each test case, print the minimum number of moves to color at least cells black, or if it's impossible. Input The first line contains a single integer () — the number of test cases. The first line of each test case contains two integers and (; ) — the number of segments and the desired number of black cells, respectively. The second line contains integers (), where is the left border of the -th segment. The third line contains integers (; ), where is the right border of the -th segment. Additional constraints on the input: every cell belongs to at most one segment; the sum of doesn't exceed . Output For each test case, print the minimum number of moves to color at least cells black, or if it's impossible. 4 2 3 1 3 1 4 4 20 10 13 16 19 11 14 17 20 2 3 1 3 1 10 2 4 99 999999999 100 1000000000 8 -1 7 1000000004 Note In the first test case, one of the optimal sequences of operations is the following: Move right: pointer is moving into cell ; Press Shift; Release Shift: cell is colored black; Move right: pointer is moving into cell ; Move right: pointer is moving into cell ; Press Shift; Move right: pointer is moving into cell ; Release Shift: cells and are colored in black. We've colored cells in moves. In the second test case, we can color at most cells, while we need cell to color. In the third test case, one of the optimal sequences of operations is the following: Move right: pointer is moving into cell ; Move right: pointer is moving into cell ; Move right: pointer is moving into cell ; Press Shift; Move right: pointer is moving into cell ; Move right: pointer is moving into cell ; Release Shift: cells , and are colored in black. We've colored cells in moves.
-
2023-5-4 16:22:15@
An integer template is a string consisting of digits and/or question marks. A positive (strictly greater than ) integer matches the integer template if it is possible to replace every question mark in the template with a digit in such a way that we get the decimal representation of that integer without any leading zeroes. For example: matches 4?; matches ????; matches 1?3?; matches 1337; does not match ??; does not match ???8; does not match 1?7. You are given an integer template consisting of at most characters. Calculate the number of positive (strictly greater than ) integers that match it. The first line contains one integer () — the number of test cases. Each test case consists of one line containing the string () consisting of digits and/or question marks — the integer template for the corresponding test case. For each test case, print one integer — the number of positive (strictly greater than ) integers that match the template. Input The first line contains one integer () — the number of test cases. Each test case consists of one line containing the string () consisting of digits and/or question marks — the integer template for the corresponding test case. Output For each test case, print one integer — the number of positive (strictly greater than ) integers that match the template. 8 ?? ? 0 9 03 1??7 ?5? 9??99 90 9 0 1 0 100 90 100
-
2023-4-28 10:44:53@
6
- 1