結果

問題 No.927 Second Permutation
ユーザー nullnull
提出日時 2019-11-22 22:05:41
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 2,455 bytes
コンパイル時間 1,210 ms
コンパイル使用メモリ 117,288 KB
最終ジャッジ日時 2025-01-08 05:01:39
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10 WA * 17
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘void scans(std::string&)’:
main.cpp:60:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   60 |         scanf("%c", &c);
      |         ~~~~~^~~~~~~~~~
main.cpp:61:28: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   61 |         if (c == '\n')scanf("%c", &c);//最初の改行対策
      |                       ~~~~~^~~~~~~~~~
main.cpp:64:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   64 |                 scanf("%c", &c);
      |                 ~~~~~^~~~~~~~~~
main.cpp: In function ‘void scanc(char&)’:
main.cpp:70:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   70 |         scanf("%c", &c);
      |         ~~~~~^~~~~~~~~~
main.cpp:73:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   73 |                 scanf("%c", &c);
      |                 ~~~~~^~~~~~~~~~

ソースコード

diff #
プレゼンテーションモードにする

/*
!
Be accepted!
_ 
。・ω・。)━☆*
      +.
    °+ *´¨)
  .· ´¸.·*´¨) ¸.·*¨)
          (¸.·´ (¸.·'* ☆
*/
#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#pragma GCC optimize("Ofast")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printin(a) printf(a ? "possible\n" : "inposible\n")
#define printdb(a) printf("%.50lf\n", a)//
#define printdbd(a) printf("%.16lf\n", a)//()
#define prints(s) printf("%s\n", s.c_str())//string
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2)//,,
#define pb push_back
#define priq priority_queue
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0)*2.0*PI)
#define rad_to_deg(rad) (((rad)/2.0/PI)*360.0)
#define Please return
#define AC 0
using ll = long long;
const int INF = 1073741823;
const int MINF = -1073741823;
const ll LINF = ll(4661686018427387903);
const ll MOD = 1000000007;
const double PI = acos(-1);
using namespace std;
void scans(string& str) {
char c;
scanf("%c", &c);
if (c == '\n')scanf("%c", &c);//
while (c != '\n' && c != -1) {
str += c;
scanf("%c", &c);
}
}
void scanc(char& str) {
char c;
scanf("%c", &c);
if (c == -1)return;
while (c == '\n') {
scanf("%c", &c);
}
str = c;
}
double acot(double x) {
return PI / 2 - atan(x);
}
/*----------------------------------------------------------------------------------*/
int main() {
string s;
scans(s);
string ss = s;
sort(all(s));
reverse(all(s));
int i = s.length() - 2;
while (i > 0 && s[i] == s[s.length() - 1]) {
--i;
}
swap(s[s.length() - 1], s[i]);
if (s == ss || s[0] == '0')s = "-1";
prints(s);
Please AC;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0