QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#510043#7658. German Conference for Public CountingMinyou0713Compile Error//C++141.8kb2024-08-08 20:47:492024-08-08 20:47:52

Judging History

你现在查看的是最新测评结果

  • [2024-08-08 20:47:52]
  • 评测
  • [2024-08-08 20:47:49]
  • 提交

answer

#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <array>
#include <vector>
#include <deque>
#include <list>
#include <forward_list>
#include <stack>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <bitset>
#include <algorithm>
#include <iterator>
#include <functional>
#include <numeric>
#include <complex>
#include <valarray>
#include <cmath>
#include <string>
#include <regex>
#include <ctime>
#include <chrono>
#include <thread>
#include <mutex>
#include <condition_variable>
#include <future>
#include <atomic>
#include <memory>
#include <new>
#include <type_traits>
#include <typeinfo>
#include <exception>
#include <stdexcept>
#include <cstdio>
#include <cstdint>
#include <utility>
#include <random>
#include <locale>
#include <codecvt>
#include <cassert>
#include <cctype>
#include <cstring>
#include <cwchar>
#include <climits>
#include <cfloat>
#include <cstdlib>
using namespace std;
#define endl '\n'
#define int long long 
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
typedef unsigned long long ull ;
typedef long long ll ;
typedef pair<int, int>PII;

void solve(){
   int n;
   cin>>n;
   if(n<10) {
      cout<<n+1;
      return ;
   }
   if(n==10){
      cout<<10;
      return ;
   }

//计算位数算法需优化
   int x = n;
   int a = 1, b = 1;
   int t = 1;
   while(x/10){
      a=x/10;
      t++;
      if(x/100==0&&x/10!=0){
         b=x%10;
      }
      x/=10;
   }

   int ans;
   if(a<=b) ans = a*t+*(t-1);
   else ans = (a-1)*t+(11-a)*(t-1);
   cout<<ans;
}

signed main(){
   IOS;
   int tt;
   tt=1;
   //cin>>tt;
   while(tt--)
      solve();
   return 0;
}

詳細信息

answer.code: In function ‘void solve()’:
answer.code:86:23: error: invalid type argument of unary ‘*’ (have ‘long long int’)
   86 |    if(a<=b) ans = a*t+*(t-1);
      |                       ^~~~~~