Diff
checker
Texte
Texte
Images
Documents
Excel
Dossiers
Legal
Enterprise
Application de bureau
Prix
Se connecter
Télécharger Diffchecker Desktop
Comparer le texte
Trouver la différence entre deux fichiers texte
Outils
Historique
Éditeur live
Cacher identiques
Sans retour à la ligne
Vue
Divisé
Unifié
Niveau de précision
Intelligent
Mot
Caractère
Coloration syntaxique
Choisir la syntaxe
Ignorer
Transformer le texte
Aller au premier écart
Modifier l'entrée
Diffchecker Desktop
La façon la plus sécurisée d'utiliser Diffchecker. Obtenez l'application Diffchecker Desktop : vos diffs ne quittent jamais votre ordinateur !
Obtenir Desktop
Untitled diff
Créé
il y a 11 ans
Le diff n'expire jamais
Effacer
Exporter
Partager
Expliquer
4 suppressions
Lignes
Total
Supprimé
Caractères
Total
Supprimé
Pour continuer à utiliser cette fonctionnalité, passez à
Diff
checker
Pro
Voir les prix
33 lignes
Copier tout
13 ajouts
Lignes
Total
Ajouté
Caractères
Total
Ajouté
Pour continuer à utiliser cette fonctionnalité, passez à
Diff
checker
Pro
Voir les prix
40 lignes
Copier tout
Copier
Copié
Copier
Copié
int
n
= readInt();
int
alphSize
= readInt();
String s = readString();
String s = readString();
Copier
Copié
Copier
Copié
int n = s.length() + 1;
int[] b = new int[n-1];
int[] b = new int[n-1];
for (int i = 0; i < n-1; i++) {
for (int i = 0; i < n-1; i++) {
Copier
Copié
Copier
Copié
if (s.charAt(i) == '
L
') b[i] = -1;
if (s.charAt(i) == '
>
') b[i] = -1;
if (s.charAt(i) == '
R
') b[i] = 1;
if (s.charAt(i) == '
<
') b[i] = 1;
if (s.charAt(i) == '=') b[i] = 0;
if (s.charAt(i) == '=') b[i] = 0;
}
}
int[] a = new int[n];
int[] a = new int[n];
a[0] = 1;
a[0] = 1;
for (int i = 1; i < n; i++) {
for (int i = 1; i < n; i++) {
if (b[i-1] == 1) {
if (b[i-1] == 1) {
a[i] = a[i-1] + 1;
a[i] = a[i-1] + 1;
continue;
continue;
}
}
if (b[i-1] == -1) {
if (b[i-1] == -1) {
a[i] = 1;
a[i] = 1;
for (int j = i-1; j >= 0; j--) {
for (int j = i-1; j >= 0; j--) {
if (a[j] == a[j+1] && b[j] == -1) a[j]++;
if (a[j] == a[j+1] && b[j] == -1) a[j]++;
else if (b[j] == 0) a[j] = a[j+1];
else if (b[j] == 0) a[j] = a[j+1];
else break;
else break;
}
}
continue;
continue;
}
}
if (b[i-1] == 0) {
if (b[i-1] == 0) {
a[i] = a[i-1];
a[i] = a[i-1];
continue;
continue;
}
}
throw new RuntimeException();
throw new RuntimeException();
}
}
for (int i = 0; i < n; i++) {
for (int i = 0; i < n; i++) {
Copier
Copié
Copier
Copié
out.print(
a[i] +
" "
);
if (a[i] > alphSize) {
out.println(-1);
return;
}
}
for (int i = 0; i < n; i++) {
out.print(
(char) (
a[i] +
'a' - 1)
);
}
}
Différences enregistrées
Texte d'origine
Ouvrir un fichier
int n = readInt(); String s = readString(); int[] b = new int[n-1]; for (int i = 0; i < n-1; i++) { if (s.charAt(i) == 'L') b[i] = -1; if (s.charAt(i) == 'R') b[i] = 1; if (s.charAt(i) == '=') b[i] = 0; } int[] a = new int[n]; a[0] = 1; for (int i = 1; i < n; i++) { if (b[i-1] == 1) { a[i] = a[i-1] + 1; continue; } if (b[i-1] == -1) { a[i] = 1; for (int j = i-1; j >= 0; j--) { if (a[j] == a[j+1] && b[j] == -1) a[j]++; else if (b[j] == 0) a[j] = a[j+1]; else break; } continue; } if (b[i-1] == 0) { a[i] = a[i-1]; continue; } throw new RuntimeException(); } for (int i = 0; i < n; i++) { out.print(a[i] + " "); }
Texte modifié
Ouvrir un fichier
int alphSize = readInt(); String s = readString(); int n = s.length() + 1; int[] b = new int[n-1]; for (int i = 0; i < n-1; i++) { if (s.charAt(i) == '>') b[i] = -1; if (s.charAt(i) == '<') b[i] = 1; if (s.charAt(i) == '=') b[i] = 0; } int[] a = new int[n]; a[0] = 1; for (int i = 1; i < n; i++) { if (b[i-1] == 1) { a[i] = a[i-1] + 1; continue; } if (b[i-1] == -1) { a[i] = 1; for (int j = i-1; j >= 0; j--) { if (a[j] == a[j+1] && b[j] == -1) a[j]++; else if (b[j] == 0) a[j] = a[j+1]; else break; } continue; } if (b[i-1] == 0) { a[i] = a[i-1]; continue; } throw new RuntimeException(); } for (int i = 0; i < n; i++) { if (a[i] > alphSize) { out.println(-1); return; } } for (int i = 0; i < n; i++) { out.print((char) (a[i] + 'a' - 1)); }
Trouver la différence