1 条题解
-
0
Guest
-
0
一道签到题 but如果直接写太简单了 直接上代码?okok
#include <cassert> #include <cctype> #include <cerrno> #include <cfloat> #include <ciso646> #include <climits> #include <clocale> #include <cmath> #include <csetjmp> #include <csignal> #include <cstdarg> #include <cstddef> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> // 这些头文件在C++中是有效的,但通常建议使用上面的<c...>形式 #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include <time.h> #include <errno.h> #include <float.h> #include <limits.h> #include <locale.h> #include <setjmp.h> #include <signal.h> #include <stdarg.h> #include <stddef.h> #include <stdio.h> #include <wchar.h> #include <wctype.h> #include <algorithm> #include <bitset> #include <complex> #include <deque> #include <exception> #include <fstream> #include <functional> #include <hash_map> // 注意:hash_map 和 hash_set 是SGI STL的一部分,并非C++98标准库的一部分,但在某些实现中可用 #include <hash_set> // 同上 #include <iomanip> #include <ios> #include <iosfwd> #include <iostream> #include <istream> #include <iterator> #include <limits> #include <list> #include <map> #include <memory> #include <new> #include <numeric> #include <ostream> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdexcept> #include <streambuf> #include <string> #include <strstream> #include <typeinfo> #include <utility> #include <valarray> #include <vector> int add(int a, int b) { return a + b; } int subtract(int a, int b) { return a - b; } int multiply(int a, int b) { return a * b; } double divide(int a, int b) { if (b != 0) return static_cast<double>(a) / b; else throw std::runtime_error("Division by zero"); } double power(double base, double exponent) { return std::pow(base, exponent); } std::string toUpperCase(const std::string& str) { std::string result = str; std::transform(result.begin(), result.end(), result.begin(), ::toupper); return result; } std::string toLowerCase(const std::string& str) { std::string result = str; std::transform(result.begin(), result.end(), result.begin(), ::tolower); return result; } bool startsWith(const std::string& str, const std::string& prefix) { return str.substr(0, prefix.length()) == prefix; } bool endsWith(const std::string& str, const std::string& suffix) { return str.substr(str.length() - suffix.length()) == suffix; } template<typename T> bool contains(const std::vector<T>& vec, const T& value) { return std::find(vec.begin(), vec.end(), value) != vec.end(); } template<typename T> void removeFromVector(std::vector<T>& vec, const T& value) { vec.erase(std::remove(vec.begin(), vec.end(), value), vec.end()); } void printArray(const int* arr, size_t size) { for (size_t i = 0; i < size; ++i) { std::cout << arr[i] << " "; } std::cout << std::endl; } void printVector(const std::vector<int>& vec) { for (int val : vec) { std::cout << val << " "; } std::cout << std::endl; } std::tm getCurrentTime() { std::time_t t = std::time(nullptr); return *std::localtime(&t); } std::string formatDateTime(const std::tm& timeinfo) { char buffer[80]; std::strftime(buffer, sizeof(buffer), "%Y-%m-%d %H:%M:%S", &timeinfo); return std::string(buffer); } bool isLeapYear(int year) { if (year % 4 == 0) { if (year % 100 == 0) { if (year % 400 == 0) { return true; } else { return false; } } else { return true; } } else { return false; } } std::string reverseString(const std::string& str) { return std::string(str.rbegin(), str.rend()); } using namespace std; int main() {freopen("picture.in","r",stdin);freopen("picture.out","w",stdout); int n; cin>>n; for(int i=0;i<n;i++) cout<<1; cout<<endl; for(int i=2;i<n;i++) { cout<<i; for(int j=0;j<n-2;j++) cout<<" "; cout<<i<<endl; }for(int i=0;i<n;i++) cout<<n; return 0; }
- 1
信息
- ID
- 765
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 7
- 标签
- (无)
- 递交数
- 66
- 已通过
- 13
- 上传者