能否给个读取与输出的格式?

wolftang 2025-04-18 11:56:52 6

#include <bits/stdc++.h> using namespace std; int main() { #ifdef LOCAL ("D:\File\202209_2_3.in", "r", stdin); #endif int n; int a,b; cin>>n; for(int i = 0;i<n;i++){ cin>>a>>b; int s = 0; for(int j = a;j<=b;j++){ int x = j; int y = 0; while(x>0){ y = y*10+x%10; x = x / 10; } if(y == j){ s++; } } cout<<s<<endl; } return 0; }

{{ vote && vote.total.up }}

共 2 条回复

wolftang

感谢!!!

CPP 刷题王
freopen("jyt.in", "r", stdin);//空格不需要,好看
freopen("jyt.out", "w", stdout);  //in out 前面的是题目要求的文件名,不加后缀。